From 913042eae10aa8ac6399c2f6fd09b74619170be1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 24 Jun 2016 09:24:46 +0200 Subject: [PATCH] Add routing as Lead Time parameter issue5560 review27291002 --- CHANGELOG | 4 +++- __init__.py | 1 + product.py | 13 +++++++++++- product.xml | 23 +++++++++++++++++++++ production.py | 9 ++++++++ view/production_lead_time_form.xml | 9 ++++++++ view/production_lead_time_list.xml | 8 +++++++ view/production_lead_time_list_sequence.xml | 8 +++++++ 8 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 view/production_lead_time_form.xml create mode 100644 view/production_lead_time_list.xml create mode 100644 view/production_lead_time_list_sequence.xml diff --git a/CHANGELOG b/CHANGELOG index 34f88f269a..965db68f37 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,2 +1,4 @@ +* Add routing as Lead Time parameter + Version 4.0.0 - 2016-05-02 -* Initial release \ No newline at end of file +* Initial release diff --git a/__init__.py b/__init__.py index d75edf17c2..3b1184cd1c 100644 --- a/__init__.py +++ b/__init__.py @@ -15,4 +15,5 @@ def register(): Routing_BOM, Production, ProductBom, + ProductionLeadTime, module='production_routing', type_='model') diff --git a/product.py b/product.py index 107ad2e164..d6c253b339 100644 --- a/product.py +++ b/product.py @@ -4,7 +4,7 @@ from trytond.pool import PoolMeta from trytond.model import fields from trytond.pyson import Eval -__all__ = ['ProductBom'] +__all__ = ['ProductBom', 'ProductionLeadTime'] class ProductBom: @@ -16,3 +16,14 @@ class ProductBom: ('boms', '=', Eval('bom', 0)), ], depends=['bom']) + + +class ProductionLeadTime: + __metaclass__ = PoolMeta + __name__ = 'production.lead_time' + routing = fields.Many2One('production.routing', 'Routing', + ondelete='CASCADE', + domain=[ + ('boms', '=', Eval('bom', 0)), + ], + depends=['bom']) diff --git a/product.xml b/product.xml index 75e3ccc559..ebdaada52b 100644 --- a/product.xml +++ b/product.xml @@ -21,5 +21,28 @@ this repository contains the full copyright notices and license terms. --> product_bom_form + + + production.lead_time + + production_lead_time_list + + + + production.lead_time + + production_lead_time_list_sequence + + + + production.lead_time + + production_lead_time_form + + diff --git a/production.py b/production.py index 44611172d0..4ac6abcbfc 100644 --- a/production.py +++ b/production.py @@ -30,6 +30,15 @@ class Production: else: self.routing = None + @fields.depends('routing') + def on_change_with_planned_start_date(self, pattern=None): + if pattern is None: + pattern = {} + pattern.setdefault( + 'routing', self.routing.id if self.routing else None) + return super(Production, self).on_change_with_planned_start_date( + pattern=pattern) + @classmethod def compute_request(cls, product, warehouse, quantity, date, company): production = super(Production, cls).compute_request( diff --git a/view/production_lead_time_form.xml b/view/production_lead_time_form.xml new file mode 100644 index 0000000000..dfb5428cc4 --- /dev/null +++ b/view/production_lead_time_form.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/view/production_lead_time_list.xml b/view/production_lead_time_list.xml new file mode 100644 index 0000000000..14bfc8a49f --- /dev/null +++ b/view/production_lead_time_list.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/view/production_lead_time_list_sequence.xml b/view/production_lead_time_list_sequence.xml new file mode 100644 index 0000000000..15b54f0cf6 --- /dev/null +++ b/view/production_lead_time_list_sequence.xml @@ -0,0 +1,8 @@ + + + + + + +