mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[IMP] mrp_multi_level: allow to specify distribution LT
This commit is contained in:
committed by
BernatPForgeFlow
parent
3ad8bf9261
commit
6de5182fe3
@@ -59,6 +59,7 @@ class ProductMRPArea(models.Model):
|
|||||||
"to be valid for the MRP.",
|
"to be valid for the MRP.",
|
||||||
)
|
)
|
||||||
mrp_lead_time = fields.Float(string="Lead Time", compute="_compute_mrp_lead_time")
|
mrp_lead_time = fields.Float(string="Lead Time", compute="_compute_mrp_lead_time")
|
||||||
|
distribution_lead_time = fields.Float()
|
||||||
main_supplier_id = fields.Many2one(
|
main_supplier_id = fields.Many2one(
|
||||||
comodel_name="res.partner",
|
comodel_name="res.partner",
|
||||||
string="Main Supplier",
|
string="Main Supplier",
|
||||||
@@ -160,12 +161,16 @@ class ProductMRPArea(models.Model):
|
|||||||
def _compute_mrp_lead_time(self):
|
def _compute_mrp_lead_time(self):
|
||||||
produced = self.filtered(lambda r: r.supply_method == "manufacture")
|
produced = self.filtered(lambda r: r.supply_method == "manufacture")
|
||||||
purchased = self.filtered(lambda r: r.supply_method == "buy")
|
purchased = self.filtered(lambda r: r.supply_method == "buy")
|
||||||
|
distributed = self.filtered(
|
||||||
|
lambda r: r.supply_method in ("pull", "push", "pull_push")
|
||||||
|
)
|
||||||
for rec in produced:
|
for rec in produced:
|
||||||
rec.mrp_lead_time = rec.product_id.produce_delay
|
rec.mrp_lead_time = rec.product_id.produce_delay
|
||||||
for rec in purchased:
|
for rec in purchased:
|
||||||
rec.mrp_lead_time = rec.main_supplierinfo_id.delay
|
rec.mrp_lead_time = rec.main_supplierinfo_id.delay
|
||||||
# TODO: 'move' supply method.
|
for rec in distributed:
|
||||||
for rec in self - produced - purchased:
|
rec.mrp_lead_time = rec.distribution_lead_time
|
||||||
|
for rec in self - produced - purchased - distributed:
|
||||||
rec.mrp_lead_time = 0
|
rec.mrp_lead_time = 0
|
||||||
|
|
||||||
def _compute_qty_available(self):
|
def _compute_qty_available(self):
|
||||||
|
|||||||
@@ -94,8 +94,15 @@
|
|||||||
<field name="mrp_maximum_order_qty" />
|
<field name="mrp_maximum_order_qty" />
|
||||||
<field name="mrp_qty_multiple" />
|
<field name="mrp_qty_multiple" />
|
||||||
<field name="supply_method" />
|
<field name="supply_method" />
|
||||||
|
<field
|
||||||
|
name="distribution_lead_time"
|
||||||
|
attrs="{'invisible': [('supply_method', 'not in', ('pull', 'push', 'pull_push'))]}"
|
||||||
|
/>
|
||||||
<field name="mrp_lead_time" />
|
<field name="mrp_lead_time" />
|
||||||
<field name="main_supplierinfo_id" />
|
<field
|
||||||
|
name="main_supplierinfo_id"
|
||||||
|
attrs="{'invisible':[('supply_method', '!=', 'buy')]}"
|
||||||
|
/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<notebook>
|
<notebook>
|
||||||
|
|||||||
Reference in New Issue
Block a user