Materialtyp: new flag 'production_relevant'; Product_view: 3 new groupings (type,categ_id,material_type_id)

develop
Andreas Osim 2018-11-21 14:57:02 +01:00
parent 3084e105fd
commit 8a0d32434e
5 changed files with 105 additions and 79 deletions

View File

@ -30,6 +30,7 @@ class MaterialType(models.Model):
print_default_code = fields.Boolean(string='Drucke Artikelnummer', required=True, help='Definiert, ob die Artikelnummer gedruckt wird') print_default_code = fields.Boolean(string='Drucke Artikelnummer', required=True, help='Definiert, ob die Artikelnummer gedruckt wird')
print_sales_pic = fields.Boolean(string='Drucke Artikelbild', default=True, required=False, help='Definiert, ob ein Artikelbild gedruckt wird (Angebot/Auftrag)') print_sales_pic = fields.Boolean(string='Drucke Artikelbild', default=True, required=False, help='Definiert, ob ein Artikelbild gedruckt wird (Angebot/Auftrag)')
print_production_pic = fields.Boolean(string='Drucke Produktionsbild', default=False, required=False, help='Definiert, ob ein Produktionsbild gedruckt wird (Produktionsauftrag)') print_production_pic = fields.Boolean(string='Drucke Produktionsbild', default=False, required=False, help='Definiert, ob ein Produktionsbild gedruckt wird (Produktionsauftrag)')
production_relevant = fields.Boolean(string='Drucke auf Produktionsschein', default=True, required=False, help='Definiert, ob ein Artikel mit diesem Materiatyp am Produktionsschein angedruckt wird. (Produktionsauftrag)')
_sql_constraints = [ _sql_constraints = [
('name_uniq', 'unique(name)', 'Die Bezeichnung muss eindeutig sein') ('name_uniq', 'unique(name)', 'Die Bezeichnung muss eindeutig sein')

View File

@ -57,6 +57,7 @@ class SaleOrder(models.Model):
assembly_notes = fields.Text() assembly_notes = fields.Text()
earliest_scheduled_date = fields.Datetime(compute='_compute_earliest_scheduled_date') earliest_scheduled_date = fields.Datetime(compute='_compute_earliest_scheduled_date')
positions = fields.Integer(string='Positionen', compute='_compute_positions') positions = fields.Integer(string='Positionen', compute='_compute_positions')
production_positions = fields.Integer(string='Positionen', compute='_compute_positions', store=False)
num_items = fields.Integer(string='Anzahl der Artikel', compute='_compute_num_items') num_items = fields.Integer(string='Anzahl der Artikel', compute='_compute_num_items')
weight_total = fields.Float(string='Gesamtgewicht', compute='_compute_weight_total') weight_total = fields.Float(string='Gesamtgewicht', compute='_compute_weight_total')
confirmation_nr = fields.Char('Freigabenummer') confirmation_nr = fields.Char('Freigabenummer')
@ -113,7 +114,14 @@ class SaleOrder(models.Model):
@api.multi @api.multi
def _compute_positions(self): def _compute_positions(self):
for record in self: for record in self:
record.positions = len(record.order_line) p = 0
pp = 0
for line in record.order_line:
p += 1
if line.product_id.material_type_id.production_relevant:
pp += 1
record.positions = p
record.production_positions = pp
@api.multi @api.multi
def _compute_num_items(self): def _compute_num_items(self):

View File

@ -11,6 +11,7 @@
<field name="print_default_code"/> <field name="print_default_code"/>
<field name="print_sales_pic"/> <field name="print_sales_pic"/>
<field name="print_production_pic"/> <field name="print_production_pic"/>
<field name="production_relevant"/>
</group> </group>
</form> </form>
</field> </field>
@ -25,6 +26,7 @@
<field name="print_default_code"/> <field name="print_default_code"/>
<field name="print_sales_pic"/> <field name="print_sales_pic"/>
<field name="print_production_pic"/> <field name="print_production_pic"/>
<field name="production_relevant"/>
</tree> </tree>
</field> </field>
</record> </record>

View File

@ -110,4 +110,17 @@
name="X-Kategorien" name="X-Kategorien"
action="product_xcategory_action"/> action="product_xcategory_action"/>
<record id="product_template_search_view_tz" model="ir.ui.view">
<field name="name">product.template.search.tz</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_search_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='categ_id']" position="after">
<filter string="Produktart" domain="[]" context="{'group_by':'type'}"/>
<filter string="Interne Kategorie" domain="[]" context="{'group_by':'categ_id'}"/>
<filter string="Materialtyp" domain="[]" context="{'group_by':'material_type_id'}"/>
</xpath>
</field>
</record>
</odoo> </odoo>

View File

@ -39,7 +39,7 @@
<strong> <strong>
<span class="col-xs-2">Positionen:</span> <span class="col-xs-2">Positionen:</span>
</strong> </strong>
<span class="col-xs-2" t-field="o.positions"/> <span class="col-xs-2" t-field="o.production_positions"/>
</div> </div>
<div class="row height-20"> <div class="row height-20">
<div class="col-xs-3" style="padding-right: 4px"> <div class="col-xs-3" style="padding-right: 4px">
@ -100,84 +100,86 @@
<tbody class="sale-tbody"> <tbody class="sale-tbody">
<t t-set="pos_nr" t-value="0"/> <t t-set="pos_nr" t-value="0"/>
<t t-foreach="o.order_line" t-as="order_line"> <t t-foreach="o.order_line" t-as="order_line">
<tr> <t t-if="order_line.product_id.material_type_id.production_relevant">
<t t-set="pos_nr" t-value="pos_nr+1"/> <tr>
<td class="text-center"> <t t-set="pos_nr" t-value="pos_nr+1"/>
<span t-esc="pos_nr"/> <td class="text-center">
</td> <span t-esc="pos_nr"/>
<td class="text-right"/> </td>
<td rowspan="2" class="text-left"> <td class="text-right"/>
<t t-if="order_line.product_id.default_code and order_line.product_id.material_type_id.print_default_code"> <td rowspan="2" class="text-left">
<strong> <t t-if="order_line.product_id.default_code and order_line.product_id.material_type_id.print_default_code">
<span t-field="order_line.product_id.default_code"/> <strong>
</strong> <span t-field="order_line.product_id.default_code"/>
<br/> </strong>
</t> <br/>
<!-- </t>
<t t-if="order_line.intrastat_id"> <!--
<span> <t t-if="order_line.intrastat_id">
<strong>Zolltarif Nr.:</strong> <span>
<span t-field="order_line.intrastat_id"/> <strong>Zolltarif Nr.:</strong>
</span> <span t-field="order_line.intrastat_id"/>
<br/> </span>
</t> <br/>
--> </t>
<span t-field="order_line.name"/> -->
<!-- <span t-field="order_line.name"/>
<t t-if="order_line.delivery_date and (order_line.delivery_date != o.delivery_date)"> <!--
<br/> <t t-if="order_line.delivery_date and (order_line.delivery_date != o.delivery_date)">
<strong>Voraussichtliches Lieferdatum:</strong> <br/>
<span t-field="order_line.delivery_date"/> <strong>Voraussichtliches Lieferdatum:</strong>
</t> <span t-field="order_line.delivery_date"/>
<p t-if="order_line.lot_id"> </t>
<span t-esc="order_line.lot_id.name.split('.')[2]"/> <p t-if="order_line.lot_id">
</p> <span t-esc="order_line.lot_id.name.split('.')[2]"/>
--> </p>
<p t-if="order_line.lot_id.notes"> -->
<span t-field="order_line.lot_id.notes"/> <p t-if="order_line.lot_id.notes">
</p> <span t-field="order_line.lot_id.notes"/>
<p t-if="o.note_line"> </p>
<span t-field="o.note_line"/> <p t-if="o.note_line">
</p> <span t-field="o.note_line"/>
</td> </p>
<td class="text-right"> </td>
<t t-if="order_line.product_uom_qty"> <td class="text-right">
<span t-esc="o._formatLang(order_line.product_uom_qty, False).strip('0').strip(',').strip('.')"/> <t t-if="order_line.product_uom_qty">
</t> <span t-esc="o._formatLang(order_line.product_uom_qty, False).strip('0').strip(',').strip('.')"/>
</td> </t>
<td class="text-right"> </td>
<t t-if="order_line.weight"> <td class="text-right">
<span t-field="order_line.weight"/> <t t-if="order_line.weight">
kg <span t-field="order_line.weight"/>
</t> kg
</td> </t>
<!-- </td>
<td rowspan="2" class="text-right"> <!--
<span t-if="order_line.hide_discount" <td rowspan="2" class="text-right">
t-field="order_line.price_reduce"/> <span t-if="order_line.hide_discount"
<span t-if="not order_line.hide_discount" t-field="order_line.price_reduce"/>
t-field="order_line.price_unit"/> <span t-if="not order_line.hide_discount"
</td> t-field="order_line.price_unit"/>
</td>
<td rowspan="2" class="text-right" t-if="discount_is_set"> <td rowspan="2" class="text-right" t-if="discount_is_set">
<t t-if="not order_line.hide_discount and order_line.discount"> <t t-if="not order_line.hide_discount and order_line.discount">
<span t-esc="o._formatLang(order_line.discount, False).strip('0').strip(',').strip('.')"/> <span t-esc="o._formatLang(order_line.discount, False).strip('0').strip(',').strip('.')"/>
% %
</t> </t>
</td> </td>
<td rowspan="2" class="text-right"> <td rowspan="2" class="text-right">
<span t-field="order_line.price_subtotal"/> <span t-field="order_line.price_subtotal"/>
</td> </td>
--> -->
</tr> </tr>
<tr> <tr>
<td colspan="2" style="border: 0;text-align: center;"> <td colspan="2" style="border: 0;text-align: center;">
<img t-if="order_line.lot_id.image_medium and order_line.product_id.material_type_id.print_production_pic" <img t-if="order_line.lot_id.image_medium and order_line.product_id.material_type_id.print_production_pic"
t-att-src="'data:image/png;base64,%s' % order_line.lot_id.image_medium.decode()" style="max-width: 128px;"/> t-att-src="'data:image/png;base64,%s' % order_line.lot_id.image_medium.decode()" style="max-width: 128px;"/>
<img t-if="not order_line.lot_id.image_medium and order_line.product_id.image_medium and order_line.product_id.material_type_id.print_production_pic" <img t-if="not order_line.lot_id.image_medium and order_line.product_id.image_medium and order_line.product_id.material_type_id.print_production_pic"
t-att-src="'data:image/png;base64,%s' % order_line.product_id.image_medium.decode()" style="max-width: 128px;"/> t-att-src="'data:image/png;base64,%s' % order_line.product_id.image_medium.decode()" style="max-width: 128px;"/>
</td> </td>
</tr> </tr>
</t>
</t> </t>
</tbody> </tbody>
</table> </table>