From b0dcef7688226b06a4f62a56d365591de8b44e8d Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Sun, 19 May 2019 16:39:33 +0200 Subject: [PATCH] [IMP] account_banking_sepa_direct_debit: Rise exception if the mandate type is not correct Closes #600 --- account_banking_sepa_direct_debit/README.rst | 2 +- .../account_banking_sepa_direct_debit.pot | 8 +- account_banking_sepa_direct_debit/i18n/de.po | 8 +- account_banking_sepa_direct_debit/i18n/es.po | 8 +- account_banking_sepa_direct_debit/i18n/fr.po | 8 +- account_banking_sepa_direct_debit/i18n/hr.po | 8 +- account_banking_sepa_direct_debit/i18n/it.po | 91 ++++++++++++++----- .../i18n/nb_NO.po | 8 +- account_banking_sepa_direct_debit/i18n/nl.po | 8 +- .../i18n/pt_BR.po | 8 +- account_banking_sepa_direct_debit/i18n/sl.po | 8 +- .../models/account_payment_order.py | 7 +- .../static/description/index.html | 4 +- 13 files changed, 139 insertions(+), 37 deletions(-) diff --git a/account_banking_sepa_direct_debit/README.rst b/account_banking_sepa_direct_debit/README.rst index 8a74f3de3..9e27232fa 100644 --- a/account_banking_sepa_direct_debit/README.rst +++ b/account_banking_sepa_direct_debit/README.rst @@ -20,7 +20,7 @@ Account Banking SEPA Direct Debit :target: https://translation.odoo-community.org/projects/bank-payment-12-0/bank-payment-12-0-account_banking_sepa_direct_debit :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/97/12.0 + :target: https://runbot.odoo-community.org/runbot/173/12.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| diff --git a/account_banking_sepa_direct_debit/i18n/account_banking_sepa_direct_debit.pot b/account_banking_sepa_direct_debit/i18n/account_banking_sepa_direct_debit.pot index 206b4e576..fdc96d081 100644 --- a/account_banking_sepa_direct_debit/i18n/account_banking_sepa_direct_debit.pot +++ b/account_banking_sepa_direct_debit/i18n/account_banking_sepa_direct_debit.pot @@ -125,7 +125,7 @@ msgid "As you changed the bank account attached to this mandate, the 'Sequence T msgstr "" #. module: account_banking_sepa_direct_debit -#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:252 +#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:257 #, python-format msgid "Automatically switched from First to Recurring when the debit order %s has been marked as uploaded." msgstr "" @@ -205,6 +205,12 @@ msgstr "" msgid "Generic Mandate" msgstr "" +#. module: account_banking_sepa_direct_debit +#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:85 +#, python-format +msgid "Invalid mandate type in '%s'. Valid ones are 'Recurrent' or 'One-Off'" +msgstr "" + #. module: account_banking_sepa_direct_debit #: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_account_banking_mandate__format msgid "Mandate Format" diff --git a/account_banking_sepa_direct_debit/i18n/de.po b/account_banking_sepa_direct_debit/i18n/de.po index 72dda49c5..766b03074 100644 --- a/account_banking_sepa_direct_debit/i18n/de.po +++ b/account_banking_sepa_direct_debit/i18n/de.po @@ -141,7 +141,7 @@ msgid "" msgstr "" #. module: account_banking_sepa_direct_debit -#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:252 +#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:257 #, python-format msgid "" "Automatically switched from First to Recurring when the debit " @@ -231,6 +231,12 @@ msgstr "Erstes" msgid "Generic Mandate" msgstr "Sepa Mandat" +#. module: account_banking_sepa_direct_debit +#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:85 +#, python-format +msgid "Invalid mandate type in '%s'. Valid ones are 'Recurrent' or 'One-Off'" +msgstr "" + #. module: account_banking_sepa_direct_debit #: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_account_banking_mandate__format msgid "Mandate Format" diff --git a/account_banking_sepa_direct_debit/i18n/es.po b/account_banking_sepa_direct_debit/i18n/es.po index 2c725f384..1b9c2919f 100644 --- a/account_banking_sepa_direct_debit/i18n/es.po +++ b/account_banking_sepa_direct_debit/i18n/es.po @@ -156,7 +156,7 @@ msgstr "" "'Tipo de secuencia' se ha vuelto a 'Inicial'." #. module: account_banking_sepa_direct_debit -#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:252 +#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:257 #, python-format msgid "" "Automatically switched from First to Recurring when the debit " @@ -265,6 +265,12 @@ msgstr "Inicial" msgid "Generic Mandate" msgstr "Mandato SEPA" +#. module: account_banking_sepa_direct_debit +#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:85 +#, python-format +msgid "Invalid mandate type in '%s'. Valid ones are 'Recurrent' or 'One-Off'" +msgstr "" + #. module: account_banking_sepa_direct_debit #: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_account_banking_mandate__format #, fuzzy diff --git a/account_banking_sepa_direct_debit/i18n/fr.po b/account_banking_sepa_direct_debit/i18n/fr.po index 1ce89d1d0..dfcba4450 100644 --- a/account_banking_sepa_direct_debit/i18n/fr.po +++ b/account_banking_sepa_direct_debit/i18n/fr.po @@ -156,7 +156,7 @@ msgstr "" "'Type de séquence' a été remis à 'First'." #. module: account_banking_sepa_direct_debit -#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:252 +#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:257 #, python-format msgid "" "Automatically switched from First to Recurring when the debit " @@ -261,6 +261,12 @@ msgstr "First" msgid "Generic Mandate" msgstr "Mandat SEPA" +#. module: account_banking_sepa_direct_debit +#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:85 +#, python-format +msgid "Invalid mandate type in '%s'. Valid ones are 'Recurrent' or 'One-Off'" +msgstr "" + #. module: account_banking_sepa_direct_debit #: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_account_banking_mandate__format #, fuzzy diff --git a/account_banking_sepa_direct_debit/i18n/hr.po b/account_banking_sepa_direct_debit/i18n/hr.po index 55810956a..bde63f08a 100644 --- a/account_banking_sepa_direct_debit/i18n/hr.po +++ b/account_banking_sepa_direct_debit/i18n/hr.po @@ -142,7 +142,7 @@ msgid "" msgstr "" #. module: account_banking_sepa_direct_debit -#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:252 +#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:257 #, python-format msgid "" "Automatically switched from First to Recurring when the debit " @@ -230,6 +230,12 @@ msgstr "" msgid "Generic Mandate" msgstr "" +#. module: account_banking_sepa_direct_debit +#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:85 +#, python-format +msgid "Invalid mandate type in '%s'. Valid ones are 'Recurrent' or 'One-Off'" +msgstr "" + #. module: account_banking_sepa_direct_debit #: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_account_banking_mandate__format msgid "Mandate Format" diff --git a/account_banking_sepa_direct_debit/i18n/it.po b/account_banking_sepa_direct_debit/i18n/it.po index faf0936f9..97df72a61 100644 --- a/account_banking_sepa_direct_debit/i18n/it.po +++ b/account_banking_sepa_direct_debit/i18n/it.po @@ -1,6 +1,6 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * account_banking_sepa_direct_debit +# * account_banking_sepa_direct_debit # msgid "" msgstr "" @@ -103,34 +103,48 @@ msgstr "Un generico mandato bancario" #. module: account_banking_sepa_direct_debit #: model_terms:ir.ui.view,arch_db:account_banking_sepa_direct_debit.sepa_direct_debit_mandate_document -msgid "ALL GAPS ARE MANDATORY. ONCE THIS MANDATE HAS BEEN SIGNED MUST BE SENT TO CREDITOR FOR STORAGE." +msgid "" +"ALL GAPS ARE MANDATORY. ONCE THIS MANDATE HAS BEEN SIGNED MUST BE SENT TO " +"CREDITOR FOR STORAGE." msgstr "" #. module: account_banking_sepa_direct_debit #: model_terms:ir.ui.view,arch_db:account_banking_sepa_direct_debit.sepa_direct_debit_mandate_document -msgid "ALL GAPS ARE MANDATORY. ONCE THIS MANDATE HAS BEEN SIGNED MUST BE SENT TO CREDITOR FOR STORAGE.\n" -" NEVERTHELESS, THE BANK OF DEBTOR REQUIRES DEBTOR’S AUTHORIZATION BEFORE DEBITING B2B DIRECT DEBITS IN THE ACCOUNT.\n" -" THE DEBTOR WILL BE ABLE TO MANAGE THE MENTIONED AUTHORIZATION THROUGH THE MEANS PROVIDED BY HIS BANK." +msgid "" +"ALL GAPS ARE MANDATORY. ONCE THIS MANDATE HAS BEEN SIGNED MUST BE SENT TO " +"CREDITOR FOR STORAGE.\n" +" NEVERTHELESS, THE BANK OF DEBTOR REQUIRES DEBTOR’S " +"AUTHORIZATION BEFORE DEBITING B2B DIRECT DEBITS IN THE ACCOUNT.\n" +" THE DEBTOR WILL BE ABLE TO MANAGE THE MENTIONED " +"AUTHORIZATION THROUGH THE MEANS PROVIDED BY HIS BANK." msgstr "" #. module: account_banking_sepa_direct_debit #: model_terms:ir.ui.view,arch_db:account_banking_sepa_direct_debit.sepa_direct_debit_mandate_document -msgid "As part of your rights, you are entitled to a refund from\n" -" your bank under the terms and conditions of your agreement\n" +msgid "" +"As part of your rights, you are entitled to a refund from\n" +" your bank under the terms and conditions of your " +"agreement\n" " with your bank.\n" -" A refund must be claimed within 8 weeks starting from the date on which your account was debited." +" A refund must be claimed within 8 weeks starting " +"from the date on which your account was debited." msgstr "" #. module: account_banking_sepa_direct_debit #: code:addons/account_banking_sepa_direct_debit/models/account_banking_mandate.py:76 #, python-format -msgid "As you changed the bank account attached to this mandate, the 'Sequence Type' has been set back to 'First'." +msgid "" +"As you changed the bank account attached to this mandate, the 'Sequence " +"Type' has been set back to 'First'." msgstr "" #. module: account_banking_sepa_direct_debit -#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:252 +#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:257 #, python-format -msgid "Automatically switched from First to Recurring when the debit order %s has been marked as uploaded." +msgid "" +"Automatically switched from First to Recurring when the debit " +"order %s has " +"been marked as uploaded." msgstr "" #. module: account_banking_sepa_direct_debit @@ -170,7 +184,10 @@ msgstr "" #. module: account_banking_sepa_direct_debit #: model:ir.model.fields,help:account_banking_sepa_direct_debit.field_account_payment_mode__sepa_creditor_identifier -msgid "Enter the Creditor Identifier that has been attributed to your company to make SEPA Direct Debits. If not defined, SEPA Creditor Identifier from company will be used.\n" +msgid "" +"Enter the Creditor Identifier that has been attributed to your company to " +"make SEPA Direct Debits. If not defined, SEPA Creditor Identifier from " +"company will be used.\n" "This identifier is composed of :\n" "- your country ISO code (2 letters)\n" "- a 2-digits checkum\n" @@ -181,7 +198,9 @@ msgstr "" #. module: account_banking_sepa_direct_debit #: model:ir.model.fields,help:account_banking_sepa_direct_debit.field_res_company__sepa_creditor_identifier #: model:ir.model.fields,help:account_banking_sepa_direct_debit.field_res_config_settings__sepa_creditor_identifier -msgid "Enter the Creditor Identifier that has been attributed to your company to make SEPA Direct Debits. This identifier is composed of :\n" +msgid "" +"Enter the Creditor Identifier that has been attributed to your company to " +"make SEPA Direct Debits. This identifier is composed of :\n" "- your country ISO code (2 letters)\n" "- a 2-digits checkum\n" "- a 3-letters business code\n" @@ -208,6 +227,12 @@ msgstr "" msgid "Generic Mandate" msgstr "" +#. module: account_banking_sepa_direct_debit +#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:85 +#, python-format +msgid "Invalid mandate type in '%s'. Valid ones are 'Recurrent' or 'One-Off'" +msgstr "" + #. module: account_banking_sepa_direct_debit #: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_account_banking_mandate__format msgid "Mandate Format" @@ -222,7 +247,9 @@ msgstr "" #. module: account_banking_sepa_direct_debit #: code:addons/account_banking_sepa_direct_debit/models/account_payment_line.py:28 #, python-format -msgid "Missing SEPA Direct Debit mandate on the line with partner {partner_name} (reference {reference})." +msgid "" +"Missing SEPA Direct Debit mandate on the line with partner {partner_name} " +"(reference {reference})." msgstr "" #. module: account_banking_sepa_direct_debit @@ -260,7 +287,10 @@ msgstr "" #. module: account_banking_sepa_direct_debit #: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:41 #, python-format -msgid "Payment Type Code '%s' is not supported. The only Payment Type Code supported for SEPA Direct Debit are 'pain.008.001.02', 'pain.008.001.03' and 'pain.008.001.04'." +msgid "" +"Payment Type Code '%s' is not supported. The only Payment Type Code " +"supported for SEPA Direct Debit are 'pain.008.001.02', 'pain.008.001.03' and " +"'pain.008.001.04'." msgstr "" #. module: account_banking_sepa_direct_debit @@ -332,13 +362,18 @@ msgstr "" #. module: account_banking_sepa_direct_debit #: code:addons/account_banking_sepa_direct_debit/models/account_payment_line.py:33 #, python-format -msgid "The SEPA Direct Debit mandate with reference {mandate_ref} for partner {partner_name} has expired." +msgid "" +"The SEPA Direct Debit mandate with reference {mandate_ref} for partner " +"{partner_name} has expired." msgstr "" #. module: account_banking_sepa_direct_debit #: code:addons/account_banking_sepa_direct_debit/models/account_payment_line.py:41 #, python-format -msgid "The SEPA Direct Debit mandate with reference {mandate_ref} for partner {partner_name} has type set to 'One-Off' but has a last debit date set to {last_debit_date}. Therefore, it cannot be used." +msgid "" +"The SEPA Direct Debit mandate with reference {mandate_ref} for partner " +"{partner_name} has type set to 'One-Off' but has a last debit date set to " +"{last_debit_date}. Therefore, it cannot be used." msgstr "" #. module: account_banking_sepa_direct_debit @@ -349,15 +384,20 @@ msgstr "" #. module: account_banking_sepa_direct_debit #: model:ir.model.fields,help:account_banking_sepa_direct_debit.field_account_banking_mandate__recurrent_sequence_type -msgid "This field is only used for Recurrent mandates, not for One-Off mandates." +msgid "" +"This field is only used for Recurrent mandates, not for One-Off mandates." msgstr "" #. module: account_banking_sepa_direct_debit #: model_terms:ir.ui.view,arch_db:account_banking_sepa_direct_debit.sepa_direct_debit_mandate_document -msgid "This mandate is only intended for business-to-business transactions.\n" -" You are not entitled to a refund from your bank after your account has\n" -" been debited, but you are entitled to request your bank\n" -" not to debit your account up until the day on which the payment is due." +msgid "" +"This mandate is only intended for business-to-business transactions.\n" +" You are not entitled to a refund from your bank " +"after your account has\n" +" been debited, but you are entitled to request your " +"bank\n" +" not to debit your account up until the day on which " +"the payment is due." msgstr "" #. module: account_banking_sepa_direct_debit @@ -438,6 +478,9 @@ msgstr "" #. module: account_banking_sepa_direct_debit #: model_terms:ir.ui.view,arch_db:account_banking_sepa_direct_debit.sepa_direct_debit_mandate_document -msgid "to send instructions to your bank to debit your account and (B) your bank to\n" -" debit your account in accordance with the instructions from" +msgid "" +"to send instructions to your bank to debit your account and (B) your bank " +"to\n" +" debit your account in accordance with the " +"instructions from" msgstr "" diff --git a/account_banking_sepa_direct_debit/i18n/nb_NO.po b/account_banking_sepa_direct_debit/i18n/nb_NO.po index 924b7bd98..7463779f7 100644 --- a/account_banking_sepa_direct_debit/i18n/nb_NO.po +++ b/account_banking_sepa_direct_debit/i18n/nb_NO.po @@ -142,7 +142,7 @@ msgid "" msgstr "" #. module: account_banking_sepa_direct_debit -#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:252 +#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:257 #, python-format msgid "" "Automatically switched from First to Recurring when the debit " @@ -230,6 +230,12 @@ msgstr "" msgid "Generic Mandate" msgstr "" +#. module: account_banking_sepa_direct_debit +#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:85 +#, python-format +msgid "Invalid mandate type in '%s'. Valid ones are 'Recurrent' or 'One-Off'" +msgstr "" + #. module: account_banking_sepa_direct_debit #: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_account_banking_mandate__format msgid "Mandate Format" diff --git a/account_banking_sepa_direct_debit/i18n/nl.po b/account_banking_sepa_direct_debit/i18n/nl.po index f5636bedb..55d03b939 100644 --- a/account_banking_sepa_direct_debit/i18n/nl.po +++ b/account_banking_sepa_direct_debit/i18n/nl.po @@ -156,7 +156,7 @@ msgstr "" "naar 'Eerste'." #. module: account_banking_sepa_direct_debit -#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:252 +#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:257 #, python-format msgid "" "Automatically switched from First to Recurring when the debit " @@ -258,6 +258,12 @@ msgstr "Eerste" msgid "Generic Mandate" msgstr "Sepa mandaat" +#. module: account_banking_sepa_direct_debit +#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:85 +#, python-format +msgid "Invalid mandate type in '%s'. Valid ones are 'Recurrent' or 'One-Off'" +msgstr "" + #. module: account_banking_sepa_direct_debit #: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_account_banking_mandate__format #, fuzzy diff --git a/account_banking_sepa_direct_debit/i18n/pt_BR.po b/account_banking_sepa_direct_debit/i18n/pt_BR.po index f480cdb09..988b796d6 100644 --- a/account_banking_sepa_direct_debit/i18n/pt_BR.po +++ b/account_banking_sepa_direct_debit/i18n/pt_BR.po @@ -142,7 +142,7 @@ msgid "" msgstr "" #. module: account_banking_sepa_direct_debit -#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:252 +#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:257 #, python-format msgid "" "Automatically switched from First to Recurring when the debit " @@ -231,6 +231,12 @@ msgstr "" msgid "Generic Mandate" msgstr "Uma ordem bancária genérica" +#. module: account_banking_sepa_direct_debit +#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:85 +#, python-format +msgid "Invalid mandate type in '%s'. Valid ones are 'Recurrent' or 'One-Off'" +msgstr "" + #. module: account_banking_sepa_direct_debit #: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_account_banking_mandate__format msgid "Mandate Format" diff --git a/account_banking_sepa_direct_debit/i18n/sl.po b/account_banking_sepa_direct_debit/i18n/sl.po index d84bfbb57..d12918d19 100644 --- a/account_banking_sepa_direct_debit/i18n/sl.po +++ b/account_banking_sepa_direct_debit/i18n/sl.po @@ -157,7 +157,7 @@ msgstr "" "vrnil v 'Prvi'." #. module: account_banking_sepa_direct_debit -#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:252 +#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:257 #, python-format msgid "" "Automatically switched from First to Recurring when the debit " @@ -261,6 +261,12 @@ msgstr "Prva" msgid "Generic Mandate" msgstr "SEPA mandat" +#. module: account_banking_sepa_direct_debit +#: code:addons/account_banking_sepa_direct_debit/models/account_payment_order.py:85 +#, python-format +msgid "Invalid mandate type in '%s'. Valid ones are 'Recurrent' or 'One-Off'" +msgstr "" + #. module: account_banking_sepa_direct_debit #: model:ir.model.fields,field_description:account_banking_sepa_direct_debit.field_account_banking_mandate__format #, fuzzy diff --git a/account_banking_sepa_direct_debit/models/account_payment_order.py b/account_banking_sepa_direct_debit/models/account_payment_order.py index 298d922e1..4e0d5ec17 100644 --- a/account_banking_sepa_direct_debit/models/account_payment_order.py +++ b/account_banking_sepa_direct_debit/models/account_payment_order.py @@ -2,7 +2,7 @@ # Copyright 2018 Tecnativa - Pedro M. Baeza # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo import _, api, fields, models +from odoo import _, api, exceptions, fields, models from odoo.exceptions import UserError from lxml import etree @@ -81,6 +81,11 @@ class AccountPaymentOrder(models.Model): seq_type_label = line.mandate_id.recurrent_sequence_type assert seq_type_label is not False seq_type = seq_type_map[seq_type_label] + else: + raise exceptions.UserError(_( + "Invalid mandate type in '%s'. Valid ones are 'Recurrent' " + "or 'One-Off'" + ) % line.mandate_id.unique_mandate_reference) # The field line.date is the requested payment date # taking into account the 'date_preferred' setting # cf account_banking_payment_export/models/account_payment.py diff --git a/account_banking_sepa_direct_debit/static/description/index.html b/account_banking_sepa_direct_debit/static/description/index.html index bf47363e8..6d00ecb15 100644 --- a/account_banking_sepa_direct_debit/static/description/index.html +++ b/account_banking_sepa_direct_debit/static/description/index.html @@ -3,7 +3,7 @@ - + Account Banking SEPA Direct Debit