[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) <flg@odoo.com>
This commit is contained in:
mehjabinfarsana
2023-08-02 05:10:51 +02:00
committed by aliya
parent cd46857b15
commit bb167d60e3
2 changed files with 11 additions and 2 deletions
+9
View File
@@ -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
+2 -2
View File
@@ -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