Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.0][MIG] hr_expense_invoice: Migration to 18.0 #282

Open
wants to merge 60 commits into
base: 18.0
Choose a base branch
from

Conversation

cav-adhoc
Copy link

@cav-adhoc cav-adhoc commented Dec 12, 2024

Changes in Odoo:

  • Before v18: The moves & payments were created & posted when posting the expense report. In v18: Approving the report creates draft account moves & payments Posting the report post the accounting entries (see [IMP] *hr_expense*: account.move creation overhaul odoo/odoo#166396)

  • Now there are two main flows at play:
                - Expense paid by the company -> Create an account payment (we only "log" the already paid expense so it can be reconciled)
                - Expense paid by he employee's own account -> As it should be reimbursed to them, it creates a vendor bill.

pedrobaeza and others added 30 commits December 12, 2024 10:57
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 <[email protected]>
Co-authored-by: Víctor Martínez <[email protected]>

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-ci and others added 15 commits December 12, 2024 10:57
Currently translated at 100.0% (15 of 15 strings)

Translation: hr-expense-16.0/hr-expense-16.0-hr_expense_invoice
Translate-URL: https://translation.odoo-community.org/projects/hr-expense-16-0/hr-expense-16-0-hr_expense_invoice/it/
- The resulting entries after posting were not correct. Now, this is
  handled this way:

  * Paid by the company: no entry is created, as the invoice represents
    the AP balance. The expense sheet payment state is controlled
    through the linked invoices payment states.
  * Paid by employee: the vendor bill that core creates is voided, and
    instead, a journal entry transferring the AP balance to the employee
    is created against the original vendor balance, that is reconciled
    and given as paid.

- When an invoice is selected in the expense, the interface was not
  properly adapted, avoiding to change certain data, and the
  corresponding were not filled as well. Now both things are performed.
- Removed the non-sense register payment constraint.
- Added smart-button to navigate from invoice to expense, as there's
  no visible link in that direction.
- Avoid the need of the field `with_invoice_id`, as it was simply a
  question of putting properly the other field as invisible and without
  groups (apart from the already existing one with groups).
- Payment state and residual amount controlled correctly for these new
  cases.
- Tests cleanup, adapted (they were manipulated in some cases to match
  the weird previous result, like in payment states) and redundancies
  were removed.

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

Translation: hr-expense-16.0/hr-expense-16.0-hr_expense_invoice
Translate-URL: https://translation.odoo-community.org/projects/hr-expense-16-0/hr-expense-16-0-hr_expense_invoice/
Currently translated at 100.0% (17 of 17 strings)

Translation: hr-expense-16.0/hr-expense-16.0-hr_expense_invoice
Translate-URL: https://translation.odoo-community.org/projects/hr-expense-16-0/hr-expense-16-0-hr_expense_invoice/it/
Actions performed:
- Deprecated `hr.expense.reference` field as part of [1].
- Merged the `hr.expense.is_editable` and `hr.expense.sheet_is_editable`
  fields as part of [1].
- Renamed `hr.expense.unit_amount` to `hr.expense.price_unit`.
- Renamed `hr.expense.attachment_number` to `hr.expense.nb_attachment`.
- Renamed `hr.expense.approve_expense_sheets()` to
  `hr.expense.action_approve_expense_sheets()`.
- Renamed `hr.expense.account_move_id` to `hr.expense.account_move_ids`.
- Renamed `hr.expense.total_amount` to
  `hr.expense.total_amount_currency`.
- Inherit compute of `hr.expense.sheet.state` to consider expenses with
  linked invoices.
- Switched from old %-based string formatting to f-strings.
- Replaced the use of `attrs` in views with their equivalent Python
  expressions as part of [2].
- Adapted the `hr.expense.sheet` records creation in tests.
- Updated to use the employee partner from `hr.employee.work_contact_id`
  instead of `hr.employee.address_home_id` since it has been split into
  multiple fields.
- Added the `hr.expense.amount_residual` field to maintain the one
  invoice per expense functionality.
- Adapted test assertions for `hr.expense.sheet.state` since it is now
  a computed field.

Co-authored-by: desdelinux <[email protected]>

[1]: odoo/odoo#130244
[2]: odoo/odoo#104741
If an expense report includes invoices from different providers,
when posting move the report moves to "paid" and invoices are not
reconciled as paid, as it fails to reconcile the lines with the
transfer moves.

Use the correct partner, from current expense line from the report,
not always the same partner from first expense line.

Fixes OCA#273
@cav-adhoc cav-adhoc mentioned this pull request Dec 12, 2024
7 tasks
@cav-adhoc cav-adhoc force-pushed the 18.0-mig-hr_expense_invoice branch 6 times, most recently from e66eb45 to cc93616 Compare December 16, 2024 16:12
@cav-adhoc cav-adhoc force-pushed the 18.0-mig-hr_expense_invoice branch from cc93616 to a75fcb3 Compare December 16, 2024 17:13
@cav-adhoc
Copy link
Author

/ocabot migration hr_expense_invoice

@OCA-git-bot
Copy link
Contributor

Sorry @cav-adhoc you are not allowed to mark the addon tobe 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.

@cav-adhoc
Copy link
Author

cav-adhoc commented Dec 23, 2024

@melanievvl @xmglord @luisg123v @pedrobaeza Hello! Can you guys review this? Thanks in advance!

@cav-adhoc
Copy link
Author

Hi @melanievvl, @xmglord, @luisg123v! Sorry to ask again, but could you please review the migration code? Thank you!

@Saran440
Copy link
Member

/ocabot migration hr_expense_invoice

@OCA-git-bot OCA-git-bot added this to the 18.0 milestone Jan 17, 2025
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.