diff --git a/base_vat_optional_vies/models/res_partner.py b/base_vat_optional_vies/models/res_partner.py index 20693cffd9e..ac705dc006f 100644 --- a/base_vat_optional_vies/models/res_partner.py +++ b/base_vat_optional_vies/models/res_partner.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# License AGPL-3: Tecnativa S.L. - Antonio Espinosa -# See README.rst file on addon root folder for more details +# Copyright 2015 Tecnativa - Antonio Espinosa +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). import logging import re @@ -38,12 +38,6 @@ def check_vat(self): if not partner.validate_vat(): raise UserError(partner._construct_constraint_msg()) - @api.multi - def button_check_vat(self): - if not self.validate_vat(): - raise UserError(self._construct_constraint_msg()) - return True - def _split_vat(self, vat, country=False): """ @summary: Split Partner vat into country_code and number diff --git a/base_vat_optional_vies/tests/test_res_partner.py b/base_vat_optional_vies/tests/test_res_partner.py index 55fb07bd172..2f025d81567 100644 --- a/base_vat_optional_vies/tests/test_res_partner.py +++ b/base_vat_optional_vies/tests/test_res_partner.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # Copyright 2015 Tecnativa - Antonio Espinosa # Copyright 2016 Tecnativa - Sergio Teruel +# Copyright 2016 Tecnativa - David Vidal # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo.tests.common import TransactionCase @@ -50,10 +51,20 @@ def _test_validate_vat(self, cases): # ('de222070543', 'DE222070543', True), # # Valid VATs don't signed up in VIES # ('DE253130868', 'DE253130868', False), - # ('esB87286357', 'ESB87286357', False), + # ('esA64970486', 'ESA64970486', False), # ) # self._test_validate_vat(cases) + def test_validate_vat_vies_true(self): + """ Validate just one """ + self.company.vat_check_vies = True + cases = ( + # vat => vat, vies_passed + # VATs signed up in VIES + ('ESB84718550', 'ESB84718550', True), + ) + self._test_validate_vat(cases) + def test_validate_vat_no_vies(self): """ Validate VAT when company 'vat_check_vies' option is False