mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[FIX] contract: Handle properly multi-company setups
If you have contracts in several companies, cron will create all of them, but property fields will be populated with incorrect data as the taken company is the main from the cron user (usually admin).
This commit is contained in:
committed by
Francisco Ivan Anton Prieto
parent
d39629a1ef
commit
46b8715806
@@ -658,7 +658,9 @@ class ContractLine(models.Model):
|
||||
}
|
||||
if invoice_id:
|
||||
invoice_line_vals['invoice_id'] = invoice_id.id
|
||||
invoice_line = self.env['account.invoice.line'].new(invoice_line_vals)
|
||||
invoice_line = self.env['account.invoice.line'].with_context(
|
||||
force_company=self.contract_id.company_id.id,
|
||||
).new(invoice_line_vals)
|
||||
# Get other invoice line values from product onchange
|
||||
invoice_line._onchange_product_id()
|
||||
invoice_line_vals = invoice_line._convert_to_write(invoice_line._cache)
|
||||
|
||||
Reference in New Issue
Block a user