[FIX] stock_account: force company when getting computed account for move line

The parent method _get_computed_account in the account module it already forces
the company to get the correct account, but in the stock_account module the method
is overriden when dealing with anglo-saxon accounting. In the latter, the company
is not being forced, so it leads to multi-company errors.

The fix simply enforces the correct company to prevent the error.

closes odoo/odoo#75747

X-original-commit: beba7c5b377e5aaf5ccb1d52e6b8c3bcf49468d3
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
This commit is contained in:
JordiMForgeFlow
2021-08-31 02:33:40 +00:00
committed by Laurent Smet
parent 7a5146cc67
commit 0b07210fe1
@@ -223,6 +223,7 @@ class AccountMoveLine(models.Model):
# OVERRIDE to use the stock input account by default on vendor bills when dealing
# with anglo-saxon accounting.
self.ensure_one()
self = self.with_company(self.move_id.journal_id.company_id)
if self.product_id.type == 'product' \
and self.move_id.company_id.anglo_saxon_accounting \
and self.move_id.is_purchase_document():