Skip to content

[19.0][FIX] account_lock_date_update: redirect unreconciled warning to account.move - #9

Open
dnplkndll wants to merge 3 commits into
19.0from
19.0-fix-lock-date-unreconciled-redirect
Open

[19.0][FIX] account_lock_date_update: redirect unreconciled warning to account.move#9
dnplkndll wants to merge 3 commits into
19.0from
19.0-fix-lock-date-unreconciled-redirect

Conversation

@dnplkndll

Copy link
Copy Markdown

What changed

Catches the RedirectWarning raised by company._validate_locks() when
fiscalyear_lock_date or hard_lock_date is set and unreconciled bank
statement lines exist in the period, and rewrites the action target from
account.bank.statement.line to account.move.

In Odoo 19 core, account.bank.statement.line has no standalone list/form
views — statement lines are embedded within journal entries. The core action
returned by _get_unreconciled_statement_lines_redirect_action() therefore
fails at render time when clicked.

Fix (_fix_redirect_warning):

  • Single-record redirect (res_id): resolves the statement line and
    replaces with account.move form pointing to line.move_id.
  • Multi-record redirect (domain on id): resolves all statement line IDs
    and replaces with account.move list domain on move_id.ids.

Tests

  • test_03_unreconciled_lines_redirect_to_account_move — creates an
    unreconciled bank statement line, locks past its date, asserts the
    raised RedirectWarning points to account.move.
  • test_04_no_unreconciled_lines_succeeds — locks to a far-past date
    with no bank statement lines; asserts execute() succeeds and the
    date is written.

Notes

This PR is the ledoent fork mirror of the fix proposed in
OCA#2244. The first commit is elemire's port of
the module; the second commit is the fix + tests.

@dnplkndll
dnplkndll force-pushed the 19.0-fix-lock-date-unreconciled-redirect branch 2 times, most recently from 2820ef0 to 0bd7569 Compare May 20, 2026 14:03
Eric Lemire and others added 2 commits May 21, 2026 15:44
@dnplkndll
dnplkndll force-pushed the 19.0-fix-lock-date-unreconciled-redirect branch from 0bd7569 to 01f6cad Compare May 21, 2026 19:45
…drop redundant ACL test, trim menu sequence)

Per @victoralmau's review (TT58567) on OCA#2244:
- tests: TransactionCase + manual context/user -> BaseCommon + new_test_user;
  run the positive flow under @users("test_lock_date_user") instead of
  per-call with_user().
- drop test_01_update_without_access — the ir.model.access.csv ACL already
  prevents a non-manager from creating the wizard (framework-tested).
- views: remove the explicit menu sequence (eval=70) — default ordering.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant