Skip to content
Snippets Groups Projects
Commit e56d91be authored by Nicolas Martinelli's avatar Nicolas Martinelli Committed by Nicolas Martinelli
Browse files

[FIX] stock_account: lock date

`_check_lock_date` is defined on a `account.move`, while in this case
`move` refers to a `stock.move`.

We re-implement a logic similar to the original commit 287b2932.

Fixes #20913
opw-782395
parent c7cc59e2
Branches
Tags
No related merge requests found
......@@ -71,7 +71,10 @@ class StockQuant(models.Model):
valuation_update = newprice - quant.cost
# this is where we post accounting entries for adjustment, if needed
# If neg quant period already closed (likely with manual valuation), skip update
if not quant.company_id.currency_id.is_zero(valuation_update) and move._check_lock_date():
lock_date = max(move.company_id.period_lock_date, move.company_id.fiscalyear_lock_date)
if self.user_has_groups('account.group_account_manager'):
lock_date = move.company_id.fiscalyear_lock_date
if not quant.company_id.currency_id.is_zero(valuation_update) and lock_date and move.date[:10] > lock_date:
quant.with_context(force_valuation_amount=valuation_update)._account_entry_move(move)
# update the standard price of the product, only if we would have
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment