From 152c02a44a3bc6f8e4a2773b158ef932a9db6537 Mon Sep 17 00:00:00 2001 From: Thomas Binsfeld Date: Wed, 6 Feb 2019 17:34:16 +0100 Subject: [PATCH] [REF] Payment Order: allow add to order from invoice if order exists --- account_payment_order/models/account_invoice.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/account_payment_order/models/account_invoice.py b/account_payment_order/models/account_invoice.py index d051f0913..6c7345ed4 100644 --- a/account_payment_order/models/account_invoice.py +++ b/account_payment_order/models/account_invoice.py @@ -79,7 +79,8 @@ class AccountInvoice(models.Model): lambda x: ( not x.reconciled and x.payment_mode_id.payment_order_ok and x.account_id.internal_type in ('receivable', 'payable') and - not x.payment_line_ids + not any(p_state in ('draft', 'open', 'generated') + for p_state in x.payment_line_ids.mapped('state')) ) ) if not applicable_lines: