diff --git a/addons/account/i18n/account.pot b/addons/account/i18n/account.pot index 8e79d5ad58a..99222322b9e 100644 --- a/addons/account/i18n/account.pot +++ b/addons/account/i18n/account.pot @@ -11824,6 +11824,13 @@ msgid "" "don't have email address." msgstr "" +#. module: account +#: code:addons/account/models/account_reconcile_model.py:0 +#, python-format +msgid "" +"The following regular expression is invalid to create a partner mapping: %s" +msgstr "" + #. module: account #: code:addons/account/models/chart_template.py:0 #, python-format diff --git a/addons/account/models/account_reconcile_model.py b/addons/account/models/account_reconcile_model.py index 757702a1612..852ffc3851e 100644 --- a/addons/account/models/account_reconcile_model.py +++ b/addons/account/models/account_reconcile_model.py @@ -24,7 +24,15 @@ class AccountReconcileModelPartnerMapping(models.Model): for record in self: if not (record.narration_regex or record.payment_ref_regex): raise ValidationError(_("Please set at least one of the match texts to create a partner mapping.")) - + try: + if record.payment_ref_regex: + current_regex = record.payment_ref_regex + re.compile(record.payment_ref_regex) + if record.narration_regex: + current_regex = record.narration_regex + re.compile(record.narration_regex) + except re.error: + raise ValidationError(_("The following regular expression is invalid to create a partner mapping: %s") % current_regex) class AccountReconcileModelLine(models.Model): _name = 'account.reconcile.model.line'