[19.0][FIX] hr_expense_cancel: find payments via reconciled_payment_ids (rework for OCA#356) - #7
Closed
dnplkndll wants to merge 3 commits into
Closed
Conversation
hr.expense.sheet was removed in 19.0; the reset flow moves to a per-expense hr.expense.action_reset() override. - action_reset() tears down linked payments (unreconcile + draft-cancel) and the posted move before super(), so core's reset guard passes. - The hr_expense_payment dependency is dropped: payments are found via core's account.move._get_reconciled_payments(), and the unreconcile walks partials via _get_reconciled_amls() instead of full_reconcile_id (partially paid expenses included).
Core's reconciled_payment_ids unions the reconciliation walk with the stored matched_payment_ids, so reset also tears down wizard payments whose reconciliation was removed and, on databases with enterprise accounting, payments that have no journal entry yet.
Drop the sudo the 19.0 retarget added (18.0 had none) and skip expenses without a move, so a plain employee reset touches no accounting model and payment teardown keeps requiring accounting ACL. Assisted-by: Claude Opus 5
dnplkndll
force-pushed
the
19.0-mig-hr_expense_cancel-rework
branch
from
July 27, 2026 19:33
e3f2fcb to
786cdee
Compare
dnplkndll
force-pushed
the
19.0-mig-hr_expense_cancel
branch
from
July 27, 2026 20:11
9272396 to
45a6ab4
Compare
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hardening follow-up to the OCA#356 dep-drop, same root cause as the #355 rework2. Do not merge — folds into the
[MIG]commit on19.0-mig-hr_expense_cancelafter approval.action_resetfound payments via_get_reconciled_payments()— reconciliation-only. Core'saccount.move.reconciled_payment_idsadditionally unions the storedmatched_payment_ids(register-wizard bookkeeping), which covers two cases the pure walk misses:account.payment.createforces an outstanding account and an entry, so this can't be tested in OCA CI).One-line swap + one new test. 5/5 green locally on stock
odoo:19.0.