[FIX] mrp: fix bom multi-company issue

on this case:
1. Reorderning rule with company 1
and related product and product template is shared mean
no company selected and related product template
contain multiple bom with different company.
so using this line
bom = (product.variant_bom_ids or product.bom_ids)[:1]
from this : `product.bom_ids` as product is inherits
by template, it's tried to read all the bom of different
company and different variant too for same template.
and that will raise multi-company issue.
so I think that should be same company as related
stock rules company.

see : https://github.com/odoo/odoo/commit/6825c440d54e38ebee13a5c184aec1a40586de0d

this was generated during upgrade database.

closes odoo/odoo#125571

X-original-commit: 4edab52bdba2bb53345506a3d83f42bfdccfcd8a
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
This commit is contained in:
Atul Patel
2023-06-27 15:00:31 +02:00
parent 1ea5eaab8e
commit 5c37a45bec
+1 -1
View File
@@ -198,7 +198,7 @@ class StockRule(models.Model):
if not manufacture_rule:
return delay, delay_description
manufacture_rule.ensure_one()
bom = values.get('bom') or (product.variant_bom_ids or product.bom_ids)[:1]
bom = values.get('bom') or self.env['mrp.bom']._bom_find(product, picking_type=manufacture_rule.picking_type_id, company_id=manufacture_rule.company_id.id)[product]
manufacture_delay = bom.produce_delay
delay += manufacture_delay
if not bypass_delay_description: