OCA / hr-expense

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

[16.0 & 17.0] hr_expense_invoice error when expense report includes invoices from diferent providers #273

Open TheCloneMaster opened 2 weeks ago

TheCloneMaster commented 2 weeks ago

Module

hr_expense_invoice

Describe the bug

If an expense report includes invoices from diferent providers, when posting move the report moves to "paid" and invoices are not reconciled as paid.

To Reproduce

Affected versions: 16.0 & 17.0

Steps to reproduce the behavior:

  1. Create vendor bill for "provider 1"
  2. Create vendor bill for "provider 2"
  3. Create expense report, one line for bill created for provider 1 and another line for provider 2
  4. Approve and post expense report As a result, the expense report is marked as paid, and the invoices remain open

Expected behavior The Expense report should move to "register payment", and the original invoices should appear as "paid"

TheCloneMaster commented 2 weeks ago

The error is in _do_create_moves on hr_expense_sheet.py. line 40 asks for the wrong vendor id... == self.expense_line_ids.invoice_id.partner_id

it should be == expense.invoice_id.partner_id

so that it takes the partner_id of current expense, not the one from the first expense from the report

I will upload a PR

Regards, -Mario