[FIX] sale: only reconcile with posted payment if linked transactions
While posting an invoice, if the transactions linked with the invoice are failed due to valid reason from the payment acquirer, forcing reconciliation on transactions' payment will raise an error because such payment isn't posted. closes odoo/odoo#82895 X-original-commit: 52937b441432b56994dda857d8cdee06b8128872 Signed-off-by: Laurent Smet <las@odoo.com>
This commit is contained in:
@@ -92,7 +92,7 @@ class AccountMove(models.Model):
|
||||
posted = super()._post(soft)
|
||||
|
||||
for invoice in posted.filtered(lambda move: move.is_invoice()):
|
||||
payments = invoice.mapped('transaction_ids.payment_id')
|
||||
payments = invoice.mapped('transaction_ids.payment_id').filtered(lambda x: x.state == 'posted')
|
||||
move_lines = payments.line_ids.filtered(lambda line: line.account_internal_type in ('receivable', 'payable') and not line.reconciled)
|
||||
for line in move_lines:
|
||||
invoice.js_assign_outstanding_line(line.id)
|
||||
|
||||
Reference in New Issue
Block a user