From d9f9d32f4e7d2408ee6245238a82b24e1fac864f Mon Sep 17 00:00:00 2001 From: Alex Tuyls Date: Thu, 7 Feb 2019 14:14:37 +0000 Subject: [PATCH] [FIX] sale_mrp: incorrect search of BOM in multicompany In following configuration: - We have two companies: A and B - We have a shared product X - We set a BOM of type KIT for this product X for company B only (the field company on a BOM is mandatory) - We set no BOM for product X for company A because in company A we sell the product as a regular product When we sell product X in company A, as a normal stockable product, the invoicing behavior is the same as when we would sell KIT products. This is because we don't check the SO company when searching the associated BOM. closes odoo/odoo#30927 --- addons/sale_mrp/models/sale_mrp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale_mrp/models/sale_mrp.py b/addons/sale_mrp/models/sale_mrp.py index 9b33c89f57c..68600642c9b 100644 --- a/addons/sale_mrp/models/sale_mrp.py +++ b/addons/sale_mrp/models/sale_mrp.py @@ -14,7 +14,7 @@ class SaleOrderLine(models.Model): # In the case of a kit, we need to check if all components are shipped. Since the BOM might # have changed, we don't compute the quantities but verify the move state. - bom = self.env['mrp.bom']._bom_find(product=self.product_id) + bom = self.env['mrp.bom']._bom_find(product=self.product_id,company_id=self.company_id.id) if bom and bom.type == 'phantom': moves = self.move_ids.filtered(lambda m: m.picking_id and m.picking_id.state != 'cancel') bom_delivered = all([move.state == 'done' for move in moves])