mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[11.0][FIX] mrp_multi_level: fix supply method computation and add required fields.
This commit is contained in:
committed by
JasminSForgeFlow
parent
55b8703ea7
commit
91bee78ae7
@@ -26,6 +26,7 @@ class MrpInventory(models.Model):
|
||||
product_mrp_area_id = fields.Many2one(
|
||||
comodel_name='product.mrp.area', string='Product Parameters',
|
||||
index=True,
|
||||
required=True,
|
||||
)
|
||||
product_id = fields.Many2one(
|
||||
comodel_name='product.product',
|
||||
|
||||
@@ -14,6 +14,7 @@ class MrpMove(models.Model):
|
||||
product_mrp_area_id = fields.Many2one(
|
||||
comodel_name="product.mrp.area",
|
||||
string="Product", index=True,
|
||||
required=True,
|
||||
)
|
||||
mrp_area_id = fields.Many2one(
|
||||
comodel_name="mrp.area",
|
||||
|
||||
@@ -15,6 +15,7 @@ class MrpPlannedOrder(models.Model):
|
||||
comodel_name="product.mrp.area",
|
||||
string="Product",
|
||||
index=True,
|
||||
required=True,
|
||||
)
|
||||
mrp_area_id = fields.Many2one(
|
||||
comodel_name="mrp.area",
|
||||
@@ -22,11 +23,13 @@ class MrpPlannedOrder(models.Model):
|
||||
string="MRP Area",
|
||||
store=True,
|
||||
index=True,
|
||||
readonly=True,
|
||||
)
|
||||
product_id = fields.Many2one(
|
||||
comodel_name="product.product",
|
||||
related="product_mrp_area_id.product_id",
|
||||
store=True,
|
||||
readonly=True,
|
||||
)
|
||||
order_release_date = fields.Date(
|
||||
string="Release Date",
|
||||
|
||||
@@ -131,13 +131,13 @@ class ProductMRPArea(models.Model):
|
||||
def _compute_supply_method(self):
|
||||
group_obj = self.env['procurement.group']
|
||||
for rec in self:
|
||||
proc_loc = rec.location_proc_id or rec.mrp_area_id.location_id
|
||||
values = {
|
||||
'warehouse_id': rec.mrp_area_id.warehouse_id,
|
||||
'company_id': self.env.user.company_id.id,
|
||||
# TODO: better way to get company
|
||||
}
|
||||
rule = group_obj._get_rule(
|
||||
rec.product_id, rec.mrp_area_id.location_id, values)
|
||||
rule = group_obj._get_rule(rec.product_id, proc_loc, values)
|
||||
rec.supply_method = rule.action if rule else 'none'
|
||||
|
||||
@api.multi
|
||||
|
||||
Reference in New Issue
Block a user