From cdacd280642c84c552973ef5e3d2bb271260b6f4 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/i18n/account_payment_order.pot | 8 ++++---- account_payment_order/models/account_invoice.py | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/account_payment_order/i18n/account_payment_order.pot b/account_payment_order/i18n/account_payment_order.pot index 9ba8e2f7c..a3176547b 100644 --- a/account_payment_order/i18n/account_payment_order.pot +++ b/account_payment_order/i18n/account_payment_order.pot @@ -14,13 +14,13 @@ msgstr "" "Plural-Forms: \n" #. module: account_payment_order -#: code:addons/account_payment_order/models/account_invoice.py:119 +#: code:addons/account_payment_order/models/account_invoice.py:120 #, python-format msgid "%d payment lines added to the existing draft payment order %s." msgstr "" #. module: account_payment_order -#: code:addons/account_payment_order/models/account_invoice.py:114 +#: code:addons/account_payment_order/models/account_invoice.py:115 #, python-format msgid "%d payment lines added to the new draft payment order %s which has been automatically created." msgstr "" @@ -742,13 +742,13 @@ msgid "No Journal Entry on invoice %s" msgstr "" #. module: account_payment_order -#: code:addons/account_payment_order/models/account_invoice.py:86 +#: code:addons/account_payment_order/models/account_invoice.py:87 #, python-format msgid "No Payment Line created for invoice %s because it already exists or because this invoice is already paid." msgstr "" #. module: account_payment_order -#: code:addons/account_payment_order/models/account_invoice.py:92 +#: code:addons/account_payment_order/models/account_invoice.py:93 #, python-format msgid "No Payment Mode on invoice %s" msgstr "" 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: