[FIX] stock_account: validating svl from different companies

Commit 7fa9ec2638 create accounting entries from stock_account in
batch. The test on `self.company_id.anglo_saxon_accounting` is
problematic in case of multi recordset. Instead, this commit evaluate
the company_id for each record of `self`.

closes odoo/odoo#64813

Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
This commit is contained in:
William Henrotin
2021-01-20 15:07:56 +00:00
parent b6494fcf28
commit 79c2d67c18
@@ -47,8 +47,8 @@ class StockValuationLayer(models.Model):
if am_vals:
account_moves = self.env['account.move'].sudo().create(am_vals)
account_moves._post()
if self.company_id.anglo_saxon_accounting:
for svl in self:
# Eventually reconcile together the invoice and valuation accounting entries on the stock interim accounts
for svl in self:
if svl.company_id.anglo_saxon_accounting:
svl.stock_move_id._get_related_invoices()._stock_account_anglo_saxon_reconcile_valuation(product=svl.product_id)