Skip to content

[19.0][MIG] hr_expense_invoice: Migration to 19.0#357

Closed
dnplkndll wants to merge 65 commits into
OCA:19.0from
ledoent:19.0-mig-hr_expense_invoice
Closed

[19.0][MIG] hr_expense_invoice: Migration to 19.0#357
dnplkndll wants to merge 65 commits into
OCA:19.0from
ledoent:19.0-mig-hr_expense_invoice

Conversation

@dnplkndll

Copy link
Copy Markdown

Port of `hr_expense_invoice` from 18.0 to 19.0 (migration guide).

Non-mechanical adaptations worth flagging

  • Hook target moved from `hr.expense.sheet.action_sheet_move_post` to `hr.expense.action_post()`. 19.0 core's `action_post` (`addons/hr_expense/models/hr_expense.py:1169`) auto-creates a receipt (own_account) or payment (company_account) per expense. Bill-linked expenses bypass that and route through the AP transfer-entry flow.
  • `account.move.expense_ids` renamed to `invoice_expense_ids` to avoid clash with 19.0 core's same-named One2many (which is the receipt-flow inverse on `account_move_id`, not the bill-link inverse on `invoice_id`). The picker domain on `hr.expense.invoice_id` now uses `invoice_expense_ids`.
  • `account.move.line.reconcile` cascade simplified. 18.0 traversed expense → sheet → set_to_paid. In 19.0, `hr.expense.state` is a computed mirror of `approval_state` + move/payment state; invalidating `amount_residual` after the AP-transfer line is reconciled is enough to recompute the cascade.
  • Sheet-only view block dropped (`hr_expense_sheet_form_view_inherit_sale_expense`) — `hr.expense.sheet` is gone. The `invoice_id` m2o on the expense form already exposes the "Create" context for new bills, replacing the per-line "Create Vendor Bill" button.
  • Bill-linked company_account path writes `approval_state='approved'` directly. Core's `_create_company_paid_moves` would otherwise duplicate the bill's obligation.

19.0 relevance

Two flows the module preserves that 19.0 core does not absorb:

  1. Pre-existing bill link — when a supplier sends an invoice to accounts (separately from the expense system), this module lets an employee file an expense that references the existing bill. Core's auto-receipt flow has no concept of "the bill already exists, just attach it."
  2. AP transfer entry for employee-paid bill-linked expenses — debit the bill's vendor AP, credit the employee's payable. Pays the employee through the existing bill-payment cycle instead of generating a parallel receipt.

UX with sheets removed: the expense form's `invoice_id` m2o is the entry point. Smart-button on `account.move` shows linked expense. Batch "create bill from N expenses" UX from the 18.0 sheet button is dropped — the 19.0 equivalent is selecting multiple expenses in the list and using core's per-expense `action_expense_create_invoice` (or a list-view action — out of scope for this slim MIG). Happy to add it if reviewers ask.

CI may surface tweaks needed on view xpaths (19.0's `hr.expense` form structure shifted around `product_id`/`quantity`); will iterate.

pedrobaeza and others added 30 commits May 27, 2026 10:59
Set supplier invoices on HR expenses
====================================

This module should be used when a supplier invoice is paid by an employee. It
allows to set  a supplier invoice for each expense line, adding the
corresponding journal items to transfer the debt to the employee.

Installation
============

Install the module the regular way.

Configuration
=============

You don't need to configure anything more to use this module.

Usage
=====

Instead of coding a full expense line, select an existing supplier invoice,
and then the rest of the fields will be auto-filled and grayed.

When you generate the expenses account entries, lines with invoices filled
will be generated as opposite of the payable move line of the invoice, and
both will be reconciled, letting the employee payable account as the only
open balance.

Known issues / Roadmap
======================

* Multiple payment terms for a supplier invoice are not handled correctly.
* Partial reconcile supplier invoices are also not correctly handled.

OCA Transbot updated translations from Transifex
…se view

OCA Transbot updated translations from Transifex
…l amount (OCA#237)

On the same expense, when we have 2 or more lines with different invoices, and each invoices have the same total amount, reconcile is not possible.

The fix is to exclude reconcile account.move.line, and the first time if we have more than one line to reconcile on the same amount, we keep the first.

OCA Transbot updated translations from Transifex
OCA Transbot updated translations from Transifex
[UPD] Update hr_expense_invoice.pot
Currently translated at 100.0% (4 of 4 strings)

Translation: hr-11.0/hr-11.0-hr_expense_invoice
Translate-URL: https://translation.odoo-community.org/projects/hr-11-0/hr-11-0-hr_expense_invoice/de/

Update translation files

Updated by Update PO files to match POT (msgmerge) hook in Weblate.
[UPD] Update hr_expense_invoice.pot

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: hr-12.0/hr-12.0-hr_expense_invoice
Translate-URL: https://translation.odoo-community.org/projects/hr-12-0/hr-12-0-hr_expense_invoice/
Add expense info to invoice info or create/edit
From expense sheet, add action "Create Invoice" from multiple expenses
Change the way reference invoice_id is checked.
- No more onchange invoice_id that set values to expense
- Instead, check amount on expense and invoice during post entry
- Change the way to allow reconcile with > 2 account move lines
Currently translated at 100.0% (4 of 4 strings)

Translation: hr-12.0/hr-12.0-hr_expense_invoice
Translate-URL: https://translation.odoo-community.org/projects/hr-12-0/hr-12-0-hr_expense_invoice/de/
Currently translated at 100.0% (4 of 4 strings)

Translation: hr-12.0/hr-12.0-hr_expense_invoice
Translate-URL: https://translation.odoo-community.org/projects/hr-12-0/hr-12-0-hr_expense_invoice/es/

[UPD] README.rst

[UPD] Update hr_expense_invoice.pot

[UPD] README.rst

hr_expense_invoice 12.0.1.3.0

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: hr-12.0/hr-12.0-hr_expense_invoice
Translate-URL: https://translation.odoo-community.org/projects/hr-12-0/hr-12-0-hr_expense_invoice/
hr_expense_invoice 12.0.1.3.1
[UPD] Update hr_expense_invoice.pot

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: hr-expense-13.0/hr-expense-13.0-hr_expense_invoice
Translate-URL: https://translation.odoo-community.org/projects/hr-expense-13-0/hr-expense-13-0-hr_expense_invoice/

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: hr-expense-13.0/hr-expense-13.0-hr_expense_invoice
Translate-URL: https://translation.odoo-community.org/projects/hr-expense-13-0/hr-expense-13-0-hr_expense_invoice/
If not, the total amount of the expense won't match to invoices
with taxes.

[UPD] README.rst
… partners.

- Intercept properly the sheet paid action for not marking it as paid when
  reconciling the expense lines that belongs to invoices.
- Prevent set invoices paid when sheet paid by company.
- Some docstring.

Co-authored-by: Pedro M. Baeza <pedro.baeza@tecnativa.com>
Co-authored-by: Víctor Martínez <victor.martinez@tecnativa.com>

hr_expense_invoice 13.0.1.1.2

[UPD] Update hr_expense_invoice.pot

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: hr-expense-13.0/hr-expense-13.0-hr_expense_invoice
Translate-URL: https://translation.odoo-community.org/projects/hr-expense-13-0/hr-expense-13-0-hr_expense_invoice/
…ing to sheet

hr_expense_invoice 13.0.1.2.0

[UPD] Update hr_expense_invoice.pot

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: hr-expense-13.0/hr-expense-13.0-hr_expense_invoice
Translate-URL: https://translation.odoo-community.org/projects/hr-expense-13-0/hr-expense-13-0-hr_expense_invoice/
…ted with expense and improve domain to prevent set same invoice in different expenses.
…e is set)

hr_expense_invoice 13.0.1.3.0

[UPD] Update hr_expense_invoice.pot

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: hr-expense-13.0/hr-expense-13.0-hr_expense_invoice
Translate-URL: https://translation.odoo-community.org/projects/hr-expense-13-0/hr-expense-13-0-hr_expense_invoice/
@OCA-git-bot OCA-git-bot added series:19.0 mod:hr_expense_invoice Module hr_expense_invoice labels May 27, 2026
@dnplkndll dnplkndll force-pushed the 19.0-mig-hr_expense_invoice branch 5 times, most recently from e5c801b to 218164f Compare May 30, 2026 15:33
@rafaelbn

Copy link
Copy Markdown
Member

/ocabot migration hr_expense_invoice

@OCA-git-bot

Copy link
Copy Markdown
Contributor

Sorry @rafaelbn you are not allowed to mark the addon to be migrated.

To do so you must either have push permissions on the repository, or be a declared maintainer of all modified addons.

If you wish to adopt an addon and become it's maintainer, open a pull request to add your GitHub login to the maintainers key of its manifest.

@rafaelbn

Copy link
Copy Markdown
Member

Hello @dnplkndll ,

Thank you for this migration 🙏🏼 ❤️

This PR is in draft, are you going to continue the migration? If so could you set the PR in open yo review?

Let me know please 😄
Thank you!

@dnplkndll dnplkndll force-pushed the 19.0-mig-hr_expense_invoice branch 4 times, most recently from 6295c74 to fbf5194 Compare June 19, 2026 18:10
@dnplkndll dnplkndll force-pushed the 19.0-mig-hr_expense_invoice branch from fbf5194 to 1f59a11 Compare June 19, 2026 19:12
@dnplkndll dnplkndll marked this pull request as ready for review June 20, 2026 13:53
@dnplkndll

Copy link
Copy Markdown
Author

Let me know please 😄 Thank you!

yes this is ready

@Shide

Shide commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Hello @dnplkndll , I'm trying to review the module, but I can't create a Vendor Bill from the Expense.
Also, you must review the README because expense sheet doesn't exist now.

Can you record a video or update readme (or modify the flow) where you can create a vendor bill from the expense and create the intermediate entry to move the debt from the vendor to the employee?

Also I need Full Accouting Features to see the vendor bill field. But can't do nothing with it.

I think you must review the entire flow and see if it is consistent

@Shide Shide left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Unable to procedure with a normal workflow

@dnplkndll dnplkndll force-pushed the 19.0-mig-hr_expense_invoice branch 2 times, most recently from 209ed18 to 09f2890 Compare June 23, 2026 11:18
@dnplkndll dnplkndll force-pushed the 19.0-mig-hr_expense_invoice branch from 09f2890 to 7cabd8a Compare June 23, 2026 11:35
@rafaelbn

Copy link
Copy Markdown
Member

Hello @pedrobaeza @victoralmau , would you like to review this PR? Thanks 😄

@Shide

Shide commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Since this workflow is still unusable, I've created another PR: #373

@dnplkndll

Copy link
Copy Markdown
Author

Superseded by #373

@dnplkndll dnplkndll closed this Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:hr_expense_invoice Module hr_expense_invoice series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.