Add routing as Lead Time parameter

issue5560
review27291002
This commit is contained in:
Cédric Krier
2016-06-24 09:24:46 +02:00
parent c27fd65046
commit 913042eae1
8 changed files with 73 additions and 2 deletions
+3 -1
View File
@@ -1,2 +1,4 @@
* Add routing as Lead Time parameter
Version 4.0.0 - 2016-05-02
* Initial release
* Initial release
+1
View File
@@ -15,4 +15,5 @@ def register():
Routing_BOM,
Production,
ProductBom,
ProductionLeadTime,
module='production_routing', type_='model')
+12 -1
View File
@@ -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'])
+23
View File
@@ -21,5 +21,28 @@ this repository contains the full copyright notices and license terms. -->
<field name="inherit" ref="production.product-bom_view_form"/>
<field name="name">product_bom_form</field>
</record>
<record model="ir.ui.view" id="production_lead_time_view_list">
<field name="model">production.lead_time</field>
<field name="inherit"
ref="production.production_lead_time_view_list"/>
<field name="name">production_lead_time_list</field>
</record>
<record model="ir.ui.view"
id="production_lead_time_view_list_sequence">
<field name="model">production.lead_time</field>
<field name="inherit"
ref="production.production_lead_time_view_list_sequence"/>
<field name="name">production_lead_time_list_sequence</field>
</record>
<record model="ir.ui.view" id="production_lead_time_view_form">
<field name="model">production.lead_time</field>
<field name="inherit"
ref="production.production_lead_time_view_form"/>
<field name="name">production_lead_time_form</field>
</record>
</data>
</tryton>
+9
View File
@@ -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(
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/form/field[@name='bom']" position="after">
<label name="routing"/>
<field name="routing" widget="selection"/>
</xpath>
</data>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/tree/field[@name='bom']" position="after">
<field name="routing"/>
</xpath>
</data>
@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/tree/field[@name='bom']" position="after">
<field name="routing" widget="selection"/>
</xpath>
</data>