[19.0][MIG] hr_expense_invoice#373
Conversation
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
[UPD] README.rst hr_expense_invoice 13.0.1.1.0
… 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/
…ent models (hr.expense.create.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/
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 <luigys@vauxoo.com> [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
…ot all being postable when invoices are in draft
Odoo is handling the amount always tax included, so we need to transfer to the invoice the proper base amount, not the price unit.
… without invoices)
Currently translated at 88.4% (23 of 26 strings) Translation: hr-expense-18.0/hr-expense-18.0-hr_expense_invoice Translate-URL: https://translation.odoo-community.org/projects/hr-expense-18-0/hr-expense-18-0-hr_expense_invoice/sl/
Currently translated at 100.0% (26 of 26 strings) Translation: hr-expense-18.0/hr-expense-18.0-hr_expense_invoice Translate-URL: https://translation.odoo-community.org/projects/hr-expense-18-0/hr-expense-18-0-hr_expense_invoice/sl/
Currently translated at 65.3% (17 of 26 strings) Translation: hr-expense-18.0/hr-expense-18.0-hr_expense_invoice Translate-URL: https://translation.odoo-community.org/projects/hr-expense-18-0/hr-expense-18-0-hr_expense_invoice/tr/
Currently translated at 100.0% (26 of 26 strings) Translation: hr-expense-18.0/hr-expense-18.0-hr_expense_invoice Translate-URL: https://translation.odoo-community.org/projects/hr-expense-18-0/hr-expense-18-0-hr_expense_invoice/sl/
|
Tests are not refactored and will fail should fail at this point. I want to review the current workflow @pedrobaeza to know if it's consistent. I'm open to modify anything |
b6b7707 to
9009056
Compare
|
Hello @pedrobaeza , there is a 4 minutes video explaining the work 😄 , as there are changes in Odoo 19 in the expense workflow. We are migrating to 19 and any change you are not agree would be dificult to resolve. If you have 10 minutes, it could be apreciated Thank! |
Gelojr
left a comment
There was a problem hiding this comment.
The implementation works correctly for the standard scenarios that were tested:
- Test 1: Expense not linked to a vendor bill, paid by the employee – OK.
- Test 2: Expense not linked to a vendor bill, paid by the company – OK.
- Test 3: Expense linked to a vendor bill, paid by the employee – OK. Note: If the product uses a "Not Applicable" tax, the invoice amount and tax must be adjusted manually.
- Test 4: Expense linked to a vendor bill, paid by the company – OK. Note: The vendor bill must be reset to draft to manually adjust the amount and tax if the tax is incorrect.
However, I found a blocking issue in the following scenario:
Steps to reproduce:
- Create an expense for €200 with a "Not Applicable" tax.
- Approve the expense.
- Generate vendor bill, set the untaxed amount to €200 and apply a 21% tax, resulting in a total of €242, then save the bill.
- Odoo correctly prevents saving the changes with the message: "You cannot modify the total amount because there is an expense linked to this bill."
- Discard the changes and try to delete the vendor bill to recreate it. The same error is displayed.
- Go back to the expense and try to reset it to draft. The same error is displayed.
- Try rejecting the expense. The status does not change.
Result:
The expense and vendor bill become locked in an inconsistent state and there is no way for the user to recover from this situation. Even though the original modification is correctly blocked, the linked documents cannot be corrected afterwards.
Could you please review this case? It seems the rollback/recovery flow should allow the user to recover from this situation instead of leaving both records blocked.
You can:
|
Gelojr
left a comment
There was a problem hiding this comment.
Nice job @Shide
The following tests have been performed:
Test 1: Expense not linked to a vendor bill, paid by the employee – OK.
Test 2: Expense not linked to a vendor bill, paid by the company – OK.
Test 3: Expense linked to a vendor bill, paid by the employee – OK. Note: If the product uses a "Not Applicable" tax, the invoice amount and tax must be adjusted manually.
Test 4: Expense linked to a vendor bill, paid by the company – OK. Note: The vendor bill must be reset to draft to manually adjust the amount and tax if the tax is incorrect.
Test 5: Vendor bill linked to an expense paid by the employee – OK. The previous issue was resolved by following @Shide 's instructions.
Test 6: Vendor bill linked to an expense paid by the company – OK.
The PR is approved.
As a possible improvement for future iterations, it may be worth reviewing whether vendor bills generated during this workflow should remain in draft state until all required information has been completed by the user. Publishing them automatically before the final review could potentially cause issues in environments with fiscal reporting integrations such as SII, TicketBAI or Batuz, where posted documents may be sent automatically.
Superseeds #357
A lot of refactor because hr_expense_sheet has been removed and the workflow has been changed completely.
Also, the normal workflow of Odoo 19 to create bills/receipts has been improved and this migration maintains the "old way" to create vendor bills.
https://www.loom.com/share/4444b9a7188e42fea9d7f14bcc8c01f8
MT-14679 @moduon @rafaelbn @pedrobaeza @victoralmau please review if you want 😄