OCA/account-financial-tools

account_journal_lock_date should only look at posted moves

dannyadair opened this issue · 3 comments

Module

account_journal_lock_date

Describe the bug

Unlike Odoo's _check_fiscalyear_lock_date(), the override does not filter the moves to only look at posted ones.
This leads to the unreasonable restriction that you cannot duplicate posted entries if their date is on or before the lock date.

To Reproduce

v13 and v14:

Steps to reproduce the behavior:

  1. Create a customer invoice
  2. Lock the sales journal with a date on or after the invoice date
  3. Try to duplicate this (now locked) invoice

Expected behavior
I expect a duplicate of the original invoice but in draft state.
Instead, I get the addon's error message of not being allowed to write because of the lock date.
However, the duplicate is a draft invoice - I'd expect that error only if I tried to post it with that date.

Odoo's check with
for move in self.filtered(lambda move: move.state == 'posted'):
https://github.com/odoo/odoo/blob/13.0/addons/account/models/account_move.py#L1585

vs. account_journal_lock_date's check with just
for move in self:
https://github.com/OCA/account-financial-tools/blob/13.0/account_journal_lock_date/models/account_move.py#L25

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.

issue still exists, also in 16.0