[FIX] account: invoices on unmatched payment
When unreconciling a payment from an invoice, the link between the payment and the invoice (in many2many invoice_ids)was kept and then the invoice still appeared when clicking on the button invoices in the payment form view. The invoice must be removed from invoice_ids. opw:691692
This commit is contained in:
@@ -972,6 +972,9 @@ class AccountMoveLine(models.Model):
|
||||
return True
|
||||
rec_move_ids = self.env['account.partial.reconcile']
|
||||
for account_move_line in self:
|
||||
for invoice in account_move_line.payment_id.invoice_ids:
|
||||
if account_move_line in invoice.payment_move_line_ids:
|
||||
account_move_line.payment_id.write({'invoice_ids': [(3, invoice.id, None)]})
|
||||
rec_move_ids += account_move_line.matched_debit_ids
|
||||
rec_move_ids += account_move_line.matched_credit_ids
|
||||
return rec_move_ids.unlink()
|
||||
|
||||
Reference in New Issue
Block a user