Skip to content

Commit ecbbf63

Browse files
[IMP] l10n_ar_ux: prevenir modificar el código de país al país de argentina
Tarea: 67659
1 parent 3da250b commit ecbbf63

3 files changed

Lines changed: 20 additions & 0 deletions

File tree

l10n_ar_ux/i18n/es.po

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ msgstr "Impuesto AFIP"
6767
msgid "According to partner VAT responsibility"
6868
msgstr "De acuerdo a la responsabilidad de IVA"
6969

70+
#. module: l10n_ar_ux
71+
#: code:addons/l10n_ar_ux/models/res_country.py:0
72+
#, python-format
73+
msgid "Argentina country code must always be 'AR'."
74+
msgstr "El código del país Argentina debe ser siempre 'AR'."
75+
7076
#. module: l10n_ar_ux
7177
#: model:ir.model,name:l10n_ar_ux.model_account_account
7278
msgid "Account"

l10n_ar_ux/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@
1313
from . import ir_actions_report
1414
from . import account_journal
1515
from . import account_account
16+
from . import res_country

l10n_ar_ux/models/res_country.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from odoo import _, api, models
2+
from odoo.exceptions import ValidationError
3+
4+
5+
class ResCountry(models.Model):
6+
_inherit = "res.country"
7+
8+
@api.constrains("code")
9+
def _check_argentina_code(self):
10+
argentina = self.env.ref("base.ar", raise_if_not_found=False)
11+
for record in self:
12+
if argentina and record.id == argentina.id and record.code != "AR":
13+
raise ValidationError(_("Argentina country code must always be 'AR'."))

0 commit comments

Comments
 (0)