Skip to content

[19.0][MIG] hr_expense_payment: Migration to 19.0#355

Draft
dnplkndll wants to merge 33 commits into
OCA:19.0from
ledoent:19.0-mig-hr_expense_payment
Draft

[19.0][MIG] hr_expense_payment: Migration to 19.0#355
dnplkndll wants to merge 33 commits into
OCA:19.0from
ledoent:19.0-mig-hr_expense_payment

Conversation

@dnplkndll
Copy link
Copy Markdown

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

Non-mechanical adaptations worth flagging

  • hr.expense.sheet is removed in 19.0 — the M2M moves to hr.expense directly. New relation table: payment_hr_expense_rel; new field names: hr.expense.payment_idsaccount.payment.expense_ids. No schema migration shipped (this is a brand-new module install on 19.0).
  • Hook target changed: 18.0 overrode hr.expense.sheet.action_register_payment. 19.0 overrides hr.expense.action_pay() (the core method that launches the register-payment wizard from an expense). Both thread the source-record ids through context so the wizard's _create_payment_vals_from_* can populate the back-link.
  • _create_payment_vals_from_batch auto-derives expenses from account.move.expense_ids when no caller context is set. 19.0 core added expense_ids as a One2many on account.move (/addons/hr_expense/models/account_move.py:12), so payments registered directly from the move side still populate the back-link without manual context threading.
  • post_init_hook now walks per-expense reconciliation via expense.account_move_id (the receipt). 18.0 walked per-sheet via sheet.account_move_ids (M2M).

19.0 relevance — community comment requested

19.0 core already provides hr.expense.action_pay() and full company-paid automation (_create_company_paid_moves at /addons/hr_expense/models/hr_expense.py:1566_prepare_payments_vals at :1619). This module is not about adding payment UI — that's in core.

This module adds:

  1. A persistent back-link from hr.expense to the account.payment records that paid it (the reverse direction core doesn't track explicitly beyond reconciliation).
  2. Batch context threading so when N expenses are paid in one wizard invocation, all N back-link to the resulting payment.

Open question for the community: should the back-link be promoted into core? The reconciliation-walking post_init_hook is non-trivial precisely because core lacks the direct field. If maintainers prefer a leaner module footprint, the hr.expense.payment_ids M2M could be a candidate for an Odoo core PR.

Happy to drop the expense_ids reverse on account.move-side wizard auto-derivation if reviewers prefer the explicit-context-only path (simpler, but loses the back-link when payments are registered from the move's own button).

Saran440 and others added 30 commits May 27, 2026 09:10
(cherry picked from commit 958f048)
(cherry picked from commit 3117aaf)
(cherry picked from commit 8af8d1d)
(cherry picked from commit 58e36ee)
(cherry picked from commit e209ca1)
(cherry picked from commit cb26762)
(cherry picked from commit 956f61c)
(cherry picked from commit dac1f33)
Currently translated at 100.0% (6 of 6 strings)

Translation: hr-expense-16.0/hr-expense-16.0-hr_expense_payment
Translate-URL: https://translation.odoo-community.org/projects/hr-expense-16-0/hr-expense-16-0-hr_expense_payment/it/
(cherry picked from commit 4aee4df)
(cherry picked from commit 7069276)
(cherry picked from commit cd2e59b)
(cherry picked from commit 0cf4e03)
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: hr-expense-16.0/hr-expense-16.0-hr_expense_payment
Translate-URL: https://translation.odoo-community.org/projects/hr-expense-16-0/hr-expense-16-0-hr_expense_payment/
(cherry picked from commit 57cb790)
(cherry picked from commit 02e018f)
(cherry picked from commit c9932e4)
(cherry picked from commit 72ceb08)
(cherry picked from commit df0b0b0)
(cherry picked from commit 6a3bf00)
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: hr-expense-18.0/hr-expense-18.0-hr_expense_payment
Translate-URL: https://translation.odoo-community.org/projects/hr-expense-18-0/hr-expense-18-0-hr_expense_payment/
(cherry picked from commit fecb164)
Currently translated at 100.0% (5 of 5 strings)

Translation: hr-expense-18.0/hr-expense-18.0-hr_expense_payment
Translate-URL: https://translation.odoo-community.org/projects/hr-expense-18-0/hr-expense-18-0-hr_expense_payment/it/
(cherry picked from commit 0b64eb0)
@OCA-git-bot OCA-git-bot added series:19.0 mod:hr_expense_payment Module hr_expense_payment labels May 27, 2026
@dnplkndll dnplkndll force-pushed the 19.0-mig-hr_expense_payment branch 2 times, most recently from bc36318 to e3d066b Compare May 27, 2026 13:46
@dnplkndll dnplkndll force-pushed the 19.0-mig-hr_expense_payment branch 3 times, most recently from e3d066b to 78afa4d Compare May 30, 2026 14:29
dnplkndll added 2 commits May 30, 2026 10:57
hr.expense.sheet was removed in 19.0; retarget the payment register to hr.expense.
@dnplkndll dnplkndll force-pushed the 19.0-mig-hr_expense_payment branch from 78afa4d to 5f7aadb Compare May 30, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:hr_expense_payment Module hr_expense_payment series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants