From 3095789b7210a73a9c96c40907dc8a645a7b4cae Mon Sep 17 00:00:00 2001 From: AaronHForgeFlow Date: Thu, 10 Jun 2021 14:29:59 +0000 Subject: [PATCH] [FIX] sale_mrp: stock_account_get_anglo_saxon_price_unit on multicompany environments closes odoo/odoo#72192 X-original-commit: 76584fda6b33a951d04d501313d5e2a564a9f6c2 Signed-off-by: Arnold Moyaux --- addons/sale_mrp/models/account_move.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/sale_mrp/models/account_move.py b/addons/sale_mrp/models/account_move.py index 8e175a97fbf..9f28147aa3d 100644 --- a/addons/sale_mrp/models/account_move.py +++ b/addons/sale_mrp/models/account_move.py @@ -11,8 +11,8 @@ class AccountMoveLine(models.Model): so_line = self.sale_line_ids and self.sale_line_ids[-1] or False if so_line: - bom = so_line.product_id.product_tmpl_id.bom_ids and so_line.product_id.product_tmpl_id.bom_ids[0] - if bom.type == 'phantom': + bom = so_line.product_id.product_tmpl_id.bom_ids.filtered(lambda b: not b.company_id or b.company_id == so_line.company_id)[:1] + if bom and bom.type == 'phantom': qty_to_invoice = self.product_uom_id._compute_quantity(self.quantity, self.product_id.uom_id) qty_invoiced = sum([x.product_uom_id._compute_quantity(x.quantity, x.product_id.uom_id) for x in so_line.invoice_lines if x.move_id.state == 'posted']) moves = so_line.move_ids