From feba353c655c2ddc0b8963756c8ba1e6b69362d8 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Thu, 26 Apr 2018 15:42:28 +0200 Subject: [PATCH] [FIX] purchase: Wrong Fiscal position in multicompany Steps to reproduce: -Create company A -Create company B -Admin user with both companies but currently in company B -Create Demo user only with company B -Create fiscal position A to company A -Create fiscal position B to company B -Create vendor with fiscal position A with company A and the same vendor with fiscal position B in company B -Create product and add the vendor created before -Set like Create a draft purchase order -Logging with Demo user -Create sale order with one sale order line with route make to order -Validate sale order Bug: The purchase order created by sale order had the fiscal position company A. Backport of this commit: 5bb65170724dcd86cebd41a5b37509c6ed145ae6 Closes #23561 opw:1825098 --- addons/purchase/models/purchase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase/models/purchase.py b/addons/purchase/models/purchase.py index 398c2b61bee..fcf8053561a 100644 --- a/addons/purchase/models/purchase.py +++ b/addons/purchase/models/purchase.py @@ -985,7 +985,7 @@ class ProcurementOrder(models.Model): self.ensure_one() schedule_date = self._get_purchase_schedule_date() purchase_date = self._get_purchase_order_date(schedule_date) - fpos = self.env['account.fiscal.position'].with_context(company_id=self.company_id.id).get_fiscal_position(partner.id) + fpos = self.env['account.fiscal.position'].with_context(force_company=self.company_id.id).get_fiscal_position(partner.id) gpo = self.rule_id.group_propagation_option group = (gpo == 'fixed' and self.rule_id.group_id.id) or \