Skip to content

Commit

Permalink
[FIX] l10n_es_aeat: Don't screw VAT check
Browse files Browse the repository at this point in the history
Since odoo/odoo#68474, the tests are failing
as Odoo is not able to recognize the country for VAT check. We do the
writing for both values at the same time for avoiding the problem.
  • Loading branch information
pedrobaeza committed Apr 6, 2021
1 parent e5cd5ce commit abff4bd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion l10n_es_aeat/__manifest__.py
Expand Up @@ -10,7 +10,7 @@
{
"name": "AEAT Base",
"summary": "Modulo base para declaraciones de la AEAT",
"version": "14.0.1.1.2",
"version": "14.0.1.1.3",
"author": "Pexego, "
"Acysos S.L., "
"AvanzOSC, "
Expand Down
22 changes: 12 additions & 10 deletions l10n_es_aeat/tests/test_l10n_es_aeat.py
Expand Up @@ -19,8 +19,9 @@ def test_format_string(self):
)

def test_parse_vat_info_es_wo_prefix(self):
self.partner.vat = "12345678Z"
self.partner.country_id = self.env.ref("base.es")
self.partner.write(
{"vat": "12345678Z", "country_id": self.env.ref("base.es").id}
)
country_code, identifier_type, vat_number = self.partner._parse_aeat_vat_info()
self.assertEqual(country_code, "ES")
self.assertEqual(identifier_type, "")
Expand All @@ -34,11 +35,11 @@ def test_parse_vat_info_es_w_prefix(self):
self.assertEqual(vat_number, "12345678Z")

def test_parse_vat_info_fr_wo_prefix(self):
self.partner.vat = "61954506077"
self.partner.country_id = self.env.ref("base.fr")
self.partner.write(
{"vat": "61954506077", "country_id": self.env.ref("base.fr").id}
)
country_code, identifier_type, vat_number = self.partner._parse_aeat_vat_info()
self.assertEqual(country_code, "FR")
self.assertEqual(identifier_type, "02")
self.assertEqual(vat_number, "61954506077")

def test_parse_vat_info_fr_w_prefix(self):
Expand All @@ -49,11 +50,11 @@ def test_parse_vat_info_fr_w_prefix(self):
self.assertEqual(vat_number, "61954506077")

def test_parse_vat_info_gf_wo_prefix(self):
self.partner.vat = "61954506077"
self.partner.country_id = self.env.ref("base.gf")
self.partner.write(
{"vat": "61954506077", "country_id": self.env.ref("base.gf").id}
)
country_code, identifier_type, vat_number = self.partner._parse_aeat_vat_info()
self.assertEqual(country_code, "FR")
self.assertEqual(identifier_type, "02")
self.assertEqual(vat_number, "61954506077")

def test_parse_vat_info_gf_w_prefix(self):
Expand All @@ -64,8 +65,9 @@ def test_parse_vat_info_gf_w_prefix(self):
self.assertEqual(vat_number, "61954506077")

def test_parse_vat_info_cu_wo_prefix(self):
self.partner.vat = "12345678Z"
self.partner.country_id = self.env.ref("base.cu")
self.partner.write(
{"vat": "12345678Z", "country_id": self.env.ref("base.cu").id}
)
country_code, identifier_type, vat_number = self.partner._parse_aeat_vat_info()
self.assertEqual(country_code, "CU")
self.assertEqual(identifier_type, "04")
Expand Down

0 comments on commit abff4bd

Please sign in to comment.