diff options
| author | Nicolas Martinelli <nim@odoo.com> | 2017-11-28 14:21:10 +0100 |
|---|---|---|
| committer | Nicolas Martinelli <nim-odoo@users.noreply.github.com> | 2017-11-28 16:17:54 +0100 |
| commit | e56d91be29bdd7baca0bf003db8bc50e8ea7b3c3 (patch) | |
| tree | b578e107ac4e246489514addc7755b8d22927f78 /addons | |
| parent | c7cc59e20dc846b81a1324b012d826e8f01d2ba8 (diff) | |
[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 287b293283ccab.
Fixes #20913
opw-782395
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/stock_account/models/stock.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/addons/stock_account/models/stock.py b/addons/stock_account/models/stock.py index f6045aa6353..aac6c1f7be1 100644 --- a/addons/stock_account/models/stock.py +++ b/addons/stock_account/models/stock.py @@ -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 |
