OCA / hr-expense

Human Resources Expenses OCA modules for Odoo
GNU Affero General Public License v3.0
50 stars 103 forks source link

[16.0][BUG] hr_expense_invoice: Can't register payment to employee if using existing invoice and follow normal process steps submit->aprove->post #267

Open peterromao opened 3 weeks ago

peterromao commented 3 weeks ago

Module

hr_expense_invoice

Describe the bug

As per the title says. When user wants to pay back to the employe the payment he has made to the vendor there is a message popping up stating that he can't register payments when the outstanding value is zero (this is the field amount_residual). All the account moves have been well posted but this variable goes to zero when it shouldn't. The circuit/process goes without hiccups when this module is not involved ie. when the expense is created without linking a vendor invoice.

To Reproduce

This has been triggered on Dockered Odoo version 16.20240730 with latest git pull of OCA/hr-expense.

  1. Create Vendor Invoice with one product line, check account moves OK pror to confirmation.
  2. Confirm Invoice. Check moves and pay status: moves OK and invoice not paid.
  3. Create new employee expense with Vendor Bill field chosing the invoice from step 2 and entering the full amount of the invoice as Total. Expenses form view shows this Total as value to report.
  4. View Expense Sheet Report, Check all is OK.
  5. Submit for aproval.
  6. Aprove. No moves posted so far.
  7. Post Journal Entries and checked that everything is OK. All the corresponding moves are posted as they should (see below). The only thing that's wrong is the Amount Due (amount_residual) that shows 0 when it shouldn't. image
  8. When user presses the Register Payment button message pops up as in image below. image

Expected behavior The Amount Due should be the residual amount left out to pay back the employee.

Additional context This has been checked in various different Odoo 16.x installations with the same behaviour.

peterromao commented 3 weeks ago

Hello, Just tested on runboat to see if it was my setup and I can confirm that the same error by design is there as well. Thanks Peter