Skip to content
Snippets Groups Projects
Commit f2a4d537 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#104895

Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
parent 367f7fba
No related branches found
No related tags found
No related merge requests found
......@@ -274,11 +274,11 @@ class StockMove(models.Model):
continue
for svl in stock_valuation_layers.with_context(active_test=False):
if not svl.product_id.valuation == 'real_time':
if not svl.with_context(force_company=svl.company_id.id).product_id.valuation == 'real_time':
continue
if svl.currency_id.is_zero(svl.value):
continue
svl.stock_move_id._account_entry_move(svl.quantity, svl.description, svl.id, svl.value)
svl.stock_move_id.with_context(force_company=svl.company_id.id)._account_entry_move(svl.quantity, svl.description, svl.id, svl.value)
stock_valuation_layers._check_company()
......
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