[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: 5bb6517072
Closes #23561
opw:1825098
This commit is contained in:
@@ -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 \
|
||||
|
||||
Reference in New Issue
Block a user