From 0d9f2ea703026daf502625720706a4fe6f2003e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Sun, 29 Sep 2024 15:32:56 +0000 Subject: [PATCH] [REF] l10n_br_cnpj_search: CNPJ->vat fix --- l10n_br_cnpj_search/__manifest__.py | 2 +- l10n_br_cnpj_search/tests/test_receitaws.py | 4 ++-- l10n_br_cnpj_search/tests/test_serpro.py | 16 ++++++---------- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/l10n_br_cnpj_search/__manifest__.py b/l10n_br_cnpj_search/__manifest__.py index b739ec80d4a8..ff8e9f73016f 100644 --- a/l10n_br_cnpj_search/__manifest__.py +++ b/l10n_br_cnpj_search/__manifest__.py @@ -5,7 +5,7 @@ "name": "Brazilian Localization CNPJ Search", "summary": """ Integração com os Webservices da ReceitaWS e SerPro""", - "version": "16.0.1.4.0", + "version": "16.0.1.4.1", "license": "AGPL-3", "author": "KMEE,Odoo Community Association (OCA)", "website": "https://github.com/OCA/l10n-brazil", diff --git a/l10n_br_cnpj_search/tests/test_receitaws.py b/l10n_br_cnpj_search/tests/test_receitaws.py index 186a0a03af16..e1212c37bbb3 100644 --- a/l10n_br_cnpj_search/tests/test_receitaws.py +++ b/l10n_br_cnpj_search/tests/test_receitaws.py @@ -62,7 +62,7 @@ def test_receita_ws_success(self): ) def test_receita_ws_fail(self): invalido = self.model.create({"name": "invalido", "cnpj_cpf": "00000000000000"}) - invalido._onchange_cnpj_cpf() + invalido._onchange_vat() with self.assertRaises(ValidationError): action_wizard = invalido.action_open_cnpj_search_wizard() @@ -76,7 +76,7 @@ def test_receita_ws_fail(self): ) def test_receita_ws_multiple_phones(self): isla = self.model.create({"name": "Isla", "cnpj_cpf": "92.666.056/0001-06"}) - isla._onchange_cnpj_cpf() + isla._onchange_vat() action_wizard = isla.action_open_cnpj_search_wizard() wizard_context = action_wizard.get("context") diff --git a/l10n_br_cnpj_search/tests/test_serpro.py b/l10n_br_cnpj_search/tests/test_serpro.py index 6308e7513f17..102581b98b9b 100644 --- a/l10n_br_cnpj_search/tests/test_serpro.py +++ b/l10n_br_cnpj_search/tests/test_serpro.py @@ -35,7 +35,7 @@ def test_serpro_basica(self): dummy_basica = self.model.create( {"name": "Dummy Basica", "cnpj_cpf": "34.238.864/0001-68"} ) - dummy_basica._onchange_cnpj_cpf() + dummy_basica._onchange_vat() action_wizard = dummy_basica.action_open_cnpj_search_wizard() wizard_context = action_wizard.get("context") @@ -71,7 +71,7 @@ def test_serpro_not_found(self): invalid = self.model.create( {"name": "invalid", "cnpj_cpf": "44.356.113/0001-08"} ) - invalid._onchange_cnpj_cpf() + invalid._onchange_vat() with self.assertRaises(ValidationError): action_wizard = invalid.action_open_cnpj_search_wizard() @@ -123,16 +123,14 @@ def assert_socios(self, partner, expected_cnpjs): ignore_localhost=True, ) def test_serpro_empresa(self): - self.model.search([("cnpj_cpf", "=", "34.238.864/0001-68")]).write( - {"active": False} - ) + self.model.search([("vat", "=", "34.238.864/0001-68")]).write({"active": False}) self.set_param("serpro_schema", "empresa") dummy_empresa = self.model.create( {"name": "Dummy Empresa", "cnpj_cpf": "34.238.864/0001-68"} ) - dummy_empresa._onchange_cnpj_cpf() + dummy_empresa._onchange_vat() action_wizard = dummy_empresa.action_open_cnpj_search_wizard() wizard_context = action_wizard.get("context") wizard = ( @@ -156,16 +154,14 @@ def test_serpro_empresa(self): ignore_localhost=True, ) def test_serpro_qsa(self): - self.model.search([("cnpj_cpf", "=", "34.238.864/0001-68")]).write( - {"active": False} - ) + self.model.search([("vat", "=", "34.238.864/0001-68")]).write({"active": False}) self.set_param("serpro_schema", "qsa") dummy_qsa = self.model.create( {"name": "Dummy QSA", "cnpj_cpf": "34.238.864/0001-68"} ) - dummy_qsa._onchange_cnpj_cpf() + dummy_qsa._onchange_vat() action_wizard = dummy_qsa.action_open_cnpj_search_wizard() wizard_context = action_wizard.get("context") wizard = (