[FIX] mrp: BOM in wrong company
- Create 2 companies C1 & C2 - Creae a product P - In C1, set the routes as MTO + Buy, add a supplier - In C2, add a BOM in kit for P - Go back to C1 with C2 as an allowed company - Create a SO for 1 unit of P, confirm The PO for P is not created. It occurs because the BOM of C2 is retrieved when running the procurement, while it shouldn't be. opw-2260945 closes odoo/odoo#51779 X-original-commit: 96b0dcf9e51f5a924e2cbf618c2ee5462cc1f03f Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com> Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
@@ -149,7 +149,11 @@ class ProcurementGroup(models.Model):
|
||||
"""
|
||||
procurements_without_kit = []
|
||||
for procurement in procurements:
|
||||
bom_kit = self.env['mrp.bom']._bom_find(product=procurement.product_id, bom_type='phantom')
|
||||
bom_kit = self.env['mrp.bom']._bom_find(
|
||||
product=procurement.product_id,
|
||||
company_id=procurement.company_id.id,
|
||||
bom_type='phantom',
|
||||
)
|
||||
if bom_kit:
|
||||
order_qty = procurement.product_uom._compute_quantity(procurement.product_qty, bom_kit.product_uom_id, round=False)
|
||||
qty_to_produce = (order_qty / bom_kit.product_qty)
|
||||
|
||||
Reference in New Issue
Block a user