Skip to content

Commit

Permalink
[FIX] Fix issue with 2 invoices on the same partner and the same tota…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
kryskool authored and kongrattapong committed Oct 31, 2019
1 parent 65bae31 commit cb49795
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion hr_expense_invoice/models/hr_expense_expense.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ def action_move_create(self):
move_lines = expense.account_move_id.line_id
c_move_lines = move_lines.filtered(
lambda x: x.partner_id == partner and
x.debit == line.invoice.residual)
x.debit == line.invoice.residual and
not x.reconcile_id)
if len(c_move_lines) > 1:
c_move_lines = c_move_lines[0]
c_move_lines |= line.invoice.move_id.line_id.filtered(
lambda x: x.account_id == line.invoice.account_id and
x.credit == line.invoice.residual)
Expand Down

0 comments on commit cb49795

Please sign in to comment.