[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
This commit is contained in:
Alex Tuyls
2019-02-07 14:14:37 +00:00
parent f5107b10f5
commit d9f9d32f4e
+1 -1
View File
@@ -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])