Skip to content

[19.0][MIG] hr_expense_cancel: Migration to 19.0 - #356

Open
dnplkndll wants to merge 25 commits into
OCA:19.0from
ledoent:19.0-mig-hr_expense_cancel
Open

[19.0][MIG] hr_expense_cancel: Migration to 19.0#356
dnplkndll wants to merge 25 commits into
OCA:19.0from
ledoent:19.0-mig-hr_expense_cancel

Conversation

@dnplkndll

@dnplkndll dnplkndll commented May 27, 2026

Copy link
Copy Markdown

Port of hr_expense_cancel from 18.0 to 19.0 (migration guide).

Non-mechanical adaptations worth flagging

  • Hook target changed from hr.expense.sheet.action_cancel to hr.expense.action_reset() — core's action_reset refuses to reset an expense linked to a posted entry; the module tears down payments and the posted move first so the guard passes. Everything runs with the caller's rights, as in 18.0: payment teardown requires accounting ACL, and expenses without a move (the everyday employee reset) touch no accounting model.
  • No dependency on hr_expense_payment: payments are found via core's reconciled_payment_ids (reconciliation walk ∪ stored matched_payment_ids, so wizard payments whose reconciliation was removed are torn down too), and _remove_move_reconcile walks partials via _get_reconciled_amls() instead of full_reconcile_id.
  • Per-expense, not per-sheet: helpers operate on expense.account_move_id.
  • payment.state rename: 18.0 'cancel' → 19.0 'canceled'.

19.0 relevance

Core's action_reset reverses the expense's move but refuses when payments exist; payment-side teardown is this module's remaining value.

AI-assisted (Claude Code); every change reviewed, tested, and owned by the author.

@dnplkndll
dnplkndll force-pushed the 19.0-mig-hr_expense_cancel branch 4 times, most recently from 1b60db9 to 5472351 Compare May 29, 2026 20:09
@dnplkndll
dnplkndll force-pushed the 19.0-mig-hr_expense_cancel branch 4 times, most recently from d6ad906 to 62ef7a7 Compare June 19, 2026 19:12
@dnplkndll
dnplkndll force-pushed the 19.0-mig-hr_expense_cancel branch from 62ef7a7 to fa7af75 Compare June 22, 2026 18:28

@pilarvargas-tecnativa pilarvargas-tecnativa left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This migration still depends on hr_expense_payment and uses its custom hr.expense.payment_ids relation.

@dnplkndll

Copy link
Copy Markdown
Author

@pilarvargas-tecnativa updated to remove the hr_expense_payment dap and I think hr_expense_payment can be dropped

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.
  Everything runs with the caller's rights, as in 18.0: payment teardown
  keeps requiring accounting ACL, and expenses without a move (the
  everyday employee reset) touch no accounting model.
- The hr_expense_payment dependency is dropped: payments are found via
  core's reconciled_payment_ids (reconciliation walk union stored
  matched_payment_ids), and the unreconcile walks partials via
  _get_reconciled_amls() instead of full_reconcile_id.

Assisted-by: Claude Opus 5
@dnplkndll
dnplkndll force-pushed the 19.0-mig-hr_expense_cancel branch from 9272396 to 45a6ab4 Compare July 27, 2026 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:hr_expense_cancel Module hr_expense_cancel series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.