From 42503104103361e4f13a2e864963b9892f6f64d0 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Tue, 11 Jul 2017 22:40:40 +0200 Subject: [PATCH] [FIX] account_banking_payment_transfer: Don't fail when no transfer move (#367) --- .../model/account_payment.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/account_banking_payment_transfer/model/account_payment.py b/account_banking_payment_transfer/model/account_payment.py index a0e1b07ad..e7ff7a270 100644 --- a/account_banking_payment_transfer/model/account_payment.py +++ b/account_banking_payment_transfer/model/account_payment.py @@ -109,12 +109,15 @@ class PaymentOrder(models.Model): Called from the workflow to move to the done state when all transfer move have been reconciled through bank statements. """ - self.env.cr.execute( - '''select id from account_move_line - where id in %s and reconcile_id is null''', - (tuple(self.get_transfer_move_line_ids()),) - ) - return self.env.cr.rowcount == 0 + transfer_move_ids = self.get_transfer_move_line_ids() + if transfer_move_ids: + self.env.cr.execute( + '''select id from account_move_line + where id in %s and reconcile_id is null''', + (tuple(transfer_move_ids),) + ) + return self.env.cr.rowcount == 0 + return True @api.multi def test_undo_done(self):