[FIX] account: analytic account fix in multicompanies env
When using _prepare_analytic_distribution_line, it would take the company for the line from the distribution, then the env. This would cause multicompany issues in some case, creating the line for the wrong company. By using current the move line to get the company before falling back on the env, we can avoid such an issue. OPW-2900827 closes odoo/odoo#96465 X-original-commit: 8c10324f062e4cd239494545cdfce7cde7ffadbb Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
This commit is contained in:
@@ -5979,7 +5979,7 @@ class AccountMoveLine(models.Model):
|
||||
'ref': self.ref,
|
||||
'move_id': self.id,
|
||||
'user_id': self.move_id.invoice_user_id.id or self._uid,
|
||||
'company_id': distribution.account_id.company_id.id or self.env.company.id,
|
||||
'company_id': distribution.account_id.company_id.id or self.company_id.id or self.env.company.id,
|
||||
}
|
||||
|
||||
@api.model
|
||||
|
||||
Reference in New Issue
Block a user