[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. Closes #23561 opw:1825098
This commit is contained in:
@@ -1012,7 +1012,7 @@ class ProcurementRule(models.Model):
|
||||
def _prepare_purchase_order(self, product_id, product_qty, product_uom, origin, values, partner):
|
||||
schedule_date = self._get_purchase_schedule_date(values)
|
||||
purchase_date = self._get_purchase_order_date(product_id, product_qty, product_uom, values, partner, schedule_date)
|
||||
fpos = self.env['account.fiscal.position'].with_context(company_id=values['company_id'].id).get_fiscal_position(partner.id)
|
||||
fpos = self.env['account.fiscal.position'].with_context(force_company=values['company_id'].id).get_fiscal_position(partner.id)
|
||||
|
||||
gpo = self.group_propagation_option
|
||||
group = (gpo == 'fixed' and self.group_id.id) or \
|
||||
|
||||
Reference in New Issue
Block a user