Skip to content

[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
19.0-mig-hr_expense_cancelfrom
19.0-mig-hr_expense_cancel-rework
Closed

[19.0][FIX] hr_expense_cancel: find payments via reconciled_payment_ids (rework for OCA#356)#7
dnplkndll wants to merge 3 commits into
19.0-mig-hr_expense_cancelfrom
19.0-mig-hr_expense_cancel-rework

Conversation

@dnplkndll

Copy link
Copy Markdown

Hardening follow-up to the OCA#356 dep-drop, same root cause as the #355 rework2. Do not merge — folds into the [MIG] commit on 19.0-mig-hr_expense_cancel after approval.

action_reset found payments via _get_reconciled_payments() — reconciliation-only. Core's account.move.reconciled_payment_ids additionally unions the stored matched_payment_ids (register-wizard bookkeeping), which covers two cases the pure walk misses:

  • a wizard payment whose reconciliation was manually removed before the reset (community-reproducible — new test);
  • wizard payments with no journal entry at all (possible when enterprise accounting is installed; in Community, account.payment.create forces 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.

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
dnplkndll force-pushed the 19.0-mig-hr_expense_cancel-rework branch from e3f2fcb to 786cdee Compare July 27, 2026 19:33
@dnplkndll
dnplkndll force-pushed the 19.0-mig-hr_expense_cancel branch from 9272396 to 45a6ab4 Compare July 27, 2026 20:11
@dnplkndll

Copy link
Copy Markdown
Author

Folded into the upstream head — OCA#356 is now at 45a6ab4 with this tree.

@dnplkndll dnplkndll closed this Jul 27, 2026
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