From efd615c2e265b19dd128a29956a1815d5a3a5740 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Tue, 19 Apr 2022 10:04:13 +0000 Subject: [PATCH] [FIX] mrp: typo that prevent to force_company The correct context key is force_company to retrieve the correct standard_price (which has company_dependent=True) Use case: - Set standard price of C as 10 in company A - Set standard price of C as 20 in company B - Create a BoM with Final Product -> Sub component (company A) - Create a BoM with Sub component -> C (company A) - Connect as company B - Open the bom structure and cost report It will display the price of C as 20. However since the BoM is used by company A it should use the price of company A (10) closes odoo/odoo#90196 X-original-commit: 275103447381c95e59e281ce6569bcce38b51815 Signed-off-by: Arnold Moyaux --- addons/mrp/report/mrp_report_bom_structure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/report/mrp_report_bom_structure.py b/addons/mrp/report/mrp_report_bom_structure.py index 788aabee1ed..b61988b007d 100644 --- a/addons/mrp/report/mrp_report_bom_structure.py +++ b/addons/mrp/report/mrp_report_bom_structure.py @@ -258,7 +258,7 @@ class ReportBomStructure(models.AbstractModel): else: prod_qty = line.product_qty * factor / bom.product_qty company = bom.company_id or self.env.company - not_rounded_price = line.product_id.uom_id._compute_price(line.product_id.with_context(force_comany=company.id).standard_price, line.product_uom_id) * prod_qty + not_rounded_price = line.product_id.uom_id._compute_price(line.product_id.with_company(company).standard_price, line.product_uom_id) * prod_qty price += company.currency_id.round(not_rounded_price) return price