From 8a0d32434e3bcc07c2014370a2f991b3d4785dd6 Mon Sep 17 00:00:00 2001 From: Andreas Osim Date: Wed, 21 Nov 2018 14:57:02 +0100 Subject: [PATCH] Materialtyp: new flag 'production_relevant'; Product_view: 3 new groupings (type,categ_id,material_type_id) --- .../dp_custom/models/material_type.py | 1 + ext/custom-addons/dp_custom/models/sale.py | 10 +- .../dp_custom/views/material_type_views.xml | 2 + .../dp_custom/views/product_views.xml | 13 ++ .../reports/report_production.xml | 158 +++++++++--------- 5 files changed, 105 insertions(+), 79 deletions(-) diff --git a/ext/custom-addons/dp_custom/models/material_type.py b/ext/custom-addons/dp_custom/models/material_type.py index 7f1ae414..5ff0a3b8 100644 --- a/ext/custom-addons/dp_custom/models/material_type.py +++ b/ext/custom-addons/dp_custom/models/material_type.py @@ -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_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)') + 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 = [ ('name_uniq', 'unique(name)', 'Die Bezeichnung muss eindeutig sein') diff --git a/ext/custom-addons/dp_custom/models/sale.py b/ext/custom-addons/dp_custom/models/sale.py index bbe0677f..7f3cb19d 100644 --- a/ext/custom-addons/dp_custom/models/sale.py +++ b/ext/custom-addons/dp_custom/models/sale.py @@ -57,6 +57,7 @@ class SaleOrder(models.Model): assembly_notes = fields.Text() earliest_scheduled_date = fields.Datetime(compute='_compute_earliest_scheduled_date') 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') weight_total = fields.Float(string='Gesamtgewicht', compute='_compute_weight_total') confirmation_nr = fields.Char('Freigabenummer') @@ -113,7 +114,14 @@ class SaleOrder(models.Model): @api.multi def _compute_positions(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 def _compute_num_items(self): diff --git a/ext/custom-addons/dp_custom/views/material_type_views.xml b/ext/custom-addons/dp_custom/views/material_type_views.xml index bf239aea..1cb78d95 100644 --- a/ext/custom-addons/dp_custom/views/material_type_views.xml +++ b/ext/custom-addons/dp_custom/views/material_type_views.xml @@ -11,6 +11,7 @@ + @@ -25,6 +26,7 @@ + diff --git a/ext/custom-addons/dp_custom/views/product_views.xml b/ext/custom-addons/dp_custom/views/product_views.xml index 9d7438e4..0a3ac137 100644 --- a/ext/custom-addons/dp_custom/views/product_views.xml +++ b/ext/custom-addons/dp_custom/views/product_views.xml @@ -110,4 +110,17 @@ name="X-Kategorien" action="product_xcategory_action"/> + + product.template.search.tz + product.template + + + + + + + + + + diff --git a/ext/custom-addons/tz_reports_production/reports/report_production.xml b/ext/custom-addons/tz_reports_production/reports/report_production.xml index 5e962e42..2da7c329 100644 --- a/ext/custom-addons/tz_reports_production/reports/report_production.xml +++ b/ext/custom-addons/tz_reports_production/reports/report_production.xml @@ -39,7 +39,7 @@ Positionen: - +
@@ -100,84 +100,86 @@ - - - - - - - - - - - -
-
- - - -

- -

-

- -

- - - - - - - - - - kg - - - + + +

+ +

+

+ +

+ + + + + + + + + + kg + + + - - - - - - - + + + + % + + + + + + --> + + + + + + + +