[IMP] account_payment_order: Concatenate all UserError messages

Gather all the errors to only show one with all the problem on the current debit order. This will avoid for the users to have to make multiple time the same process.
This commit is contained in:
Simon Gonzalez
2023-02-17 08:22:13 +01:00
committed by David Ramia
parent ad31eab5de
commit 867c8c030f
42 changed files with 301 additions and 10 deletions

View File

@@ -9,7 +9,7 @@
{
"name": "Account Payment Order",
"version": "16.0.1.0.1",
"version": "16.0.1.0.2",
"license": "AGPL-3",
"author": "ACSONE SA/NV, "
"Therp BV, "

View File

@@ -1097,6 +1097,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1104,6 +1104,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1105,6 +1105,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1138,6 +1138,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr "No hi han transaccions a l'ordre de pagament %s."
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1100,6 +1100,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1104,6 +1104,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1110,6 +1110,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1109,6 +1109,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr "Auf Zahlungsauftrag %s sind keine Transaktionen vorhanden."
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1106,6 +1106,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1142,6 +1142,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr "No hay transacciones en la orden %s."
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1134,6 +1134,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr "No hay transacciones en la orden %s."
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1135,6 +1135,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr "No hay transacciones en el pago de nómina %s."
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1105,6 +1105,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1105,6 +1105,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1105,6 +1105,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1105,6 +1105,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1105,6 +1105,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1104,6 +1104,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1104,6 +1104,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1160,6 +1160,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr "Il n'y a aucune opération sur l'ordre de paiement %s."
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1137,6 +1137,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr "Il n'y a aucune opération sur l'ordre de paiement %s."
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1104,6 +1104,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1115,6 +1115,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1107,6 +1107,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1105,6 +1105,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1122,6 +1122,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1136,6 +1136,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1105,6 +1105,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1106,6 +1106,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1105,6 +1105,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1104,6 +1104,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1115,6 +1115,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1105,6 +1105,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1105,6 +1105,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1106,6 +1106,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1116,6 +1116,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1104,6 +1104,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1104,6 +1104,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1104,6 +1104,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -1104,6 +1104,13 @@ msgstr ""
msgid "There are no transactions on payment order %s."
msgstr ""
#. module: account_payment_order
#. odoo-python
#: code:addons/account_payment_order/models/account_payment_order.py:0
#, python-format
msgid "There's at least one validation error:\n"
msgstr ""
#. module: account_payment_order
#: model:ir.model.fields,help:account_payment_order.field_account_payment_line__ml_maturity_date
msgid ""

View File

@@ -292,9 +292,13 @@ class AccountPaymentOrder(models.Model):
order.payment_ids.action_cancel()
order.payment_ids.unlink()
# Prepare account payments from the payment lines
payline_err_text = []
group_paylines = {} # key = hashcode
for payline in order.payment_line_ids:
payline.draft2open_payment_line_check()
try:
payline.draft2open_payment_line_check()
except UserError as e:
payline_err_text.append(e.args[0])
# Compute requested payment date
if order.date_prefered == "due":
requested_date = payline.ml_maturity_date or payline.date or today
@@ -303,8 +307,7 @@ class AccountPaymentOrder(models.Model):
else:
requested_date = today
# No payment date in the past
if requested_date < today:
requested_date = today
requested_date = max(today, requested_date)
# inbound: check option no_debit_before_maturity
if (
order.payment_type == "inbound"
@@ -312,7 +315,7 @@ class AccountPaymentOrder(models.Model):
and payline.ml_maturity_date
and requested_date < payline.ml_maturity_date
):
raise UserError(
payline_err_text.append(
_(
"The payment mode '%(pmode)s' has the option "
"'Disallow Debit Before Maturity Date'. The "
@@ -332,11 +335,11 @@ class AccountPaymentOrder(models.Model):
with self.env.norecompute():
payline.date = requested_date
# Group options
if order.payment_mode_id.group_lines:
hashcode = payline.payment_line_hashcode()
else:
# Use line ID as hascode, which actually means no grouping
hashcode = payline.id
hashcode = (
payline.payment_line_hashcode()
if order.payment_mode_id.group_lines
else payline.id
)
if hashcode in group_paylines:
group_paylines[hashcode]["paylines"] += payline
group_paylines[hashcode]["total"] += payline.amount_currency
@@ -345,7 +348,15 @@ class AccountPaymentOrder(models.Model):
"paylines": payline,
"total": payline.amount_currency,
}
# Raise errors that happened on the validation process
if payline_err_text:
raise UserError(
_("There's at least one validation error:\n")
+ "\n".join(payline_err_text)
)
order.env.flush_all()
# Create account payments
payment_vals = []
for paydict in list(group_paylines.values()):