From bb167d60e3393541aa76553317f737aea0319965 Mon Sep 17 00:00:00 2001 From: mehjabinfarsana Date: Thu, 20 Jul 2023 08:41:27 +0000 Subject: [PATCH] [FIX] l10n_sa_edi: make user error message translatable before this commit, the user error message on changing ZATKA submission mode was not translatable to user language after this commit, user error message will be shown in user's language closes odoo/odoo#130323 X-original-commit: e00e253658cb0eefa8ea0f726f0a3bec6eaca7e6 Signed-off-by: Florian Gilbert (flg) --- addons/l10n_sa_edi/i18n/l10n_sa_edi.pot | 9 +++++++++ addons/l10n_sa_edi/models/res_company.py | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/addons/l10n_sa_edi/i18n/l10n_sa_edi.pot b/addons/l10n_sa_edi/i18n/l10n_sa_edi.pot index c2ff0df9074..7efdbe780a1 100644 --- a/addons/l10n_sa_edi/i18n/l10n_sa_edi.pot +++ b/addons/l10n_sa_edi/i18n/l10n_sa_edi.pot @@ -1062,6 +1062,15 @@ msgid "" " Once you have selected the correct API, you can start the Onboarding process by going to the Journals and checking the options under the ZATCA tab." msgstr "" +#. module: l10n_sa_edi +#. odoo-python +#: code:addons/l10n_sa_edi/models/res_company.py:0 +#, python-format +msgid "" +"You cannot change the ZATCA Submission Mode once it has been set to " +"Production" +msgstr "" + #. module: l10n_sa_edi #: code:addons/l10n_sa_edi/wizard/l10n_sa_edi_otp_wizard.py:0 #, python-format diff --git a/addons/l10n_sa_edi/models/res_company.py b/addons/l10n_sa_edi/models/res_company.py index f18c2ccb0f4..3c9100ec648 100644 --- a/addons/l10n_sa_edi/models/res_company.py +++ b/addons/l10n_sa_edi/models/res_company.py @@ -1,5 +1,5 @@ import re -from odoo import models, fields +from odoo import models, fields, _ from odoo.exceptions import UserError from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import serialization @@ -54,7 +54,7 @@ class ResCompany(models.Model): for company in self: if 'l10n_sa_api_mode' in vals: if company.l10n_sa_api_mode == 'prod' and vals['l10n_sa_api_mode'] != 'prod': - raise UserError("You cannot change the ZATCA Submission Mode once it has been set to Production") + raise UserError(_("You cannot change the ZATCA Submission Mode once it has been set to Production")) journals = self.env['account.journal'].search(self.env['account.journal']._check_company_domain(company)) journals._l10n_sa_reset_certificates() journals.l10n_sa_latest_submission_hash = False