Skip to content
Snippets Groups Projects
Commit 6a8df26f authored by David (dafr)'s avatar David (dafr)
Browse files

[FIX] stock_account: Use correct company for SVL account_move creation


The valuation field of the product_id is company-dependent.
If the user validate the picking in multi-company context with his current company != picking company, then the checks may fail, and the account move can not be created.

closes odoo/odoo#105272

X-original-commit: 33fa9cff
Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
parent f57bca2e
No related branches found
No related tags found
No related merge requests found
......@@ -39,11 +39,11 @@ class StockValuationLayer(models.Model):
def _validate_accounting_entries(self):
am_vals = []
for svl in self:
if not svl.product_id.valuation == 'real_time':
if not svl.with_company(svl.company_id).product_id.valuation == 'real_time':
continue
if svl.currency_id.is_zero(svl.value):
continue
am_vals += svl.stock_move_id._account_entry_move(svl.quantity, svl.description, svl.id, svl.value)
am_vals += svl.stock_move_id.with_company(svl.company_id)._account_entry_move(svl.quantity, svl.description, svl.id, svl.value)
if am_vals:
account_moves = self.env['account.move'].sudo().create(am_vals)
account_moves._post()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment