2
0

[FIX] Some fixes:

* base_vat_optional_vies: Fix pass lower country code in _split_vat function to find parent function check_vat_'xx' instead of check_vat_'XX'
  * base_vat_optional_vies: Convert to upper when write NIF into database
This commit is contained in:
Sergio Teruel Albert 2016-12-13 12:57:06 +01:00 committed by Rodrigo
parent 6ba2b16969
commit 36106a4d8a
7 changed files with 15 additions and 18 deletions

View File

@ -21,7 +21,8 @@ Configuration
============= =============
In order to activate VIES validation, you must set this option in your company: In order to activate VIES validation, you must set this option in your company:
Settings > Companies > Companies > Your Company > Configuration > Accounting > VIES VAT Check Settings > Companies > Companies > Your Company > Configuration > Accounting
> VIES VAT Check
Usage Usage
@ -46,10 +47,10 @@ bypass country validation you can use "EU" code
Bug Tracker Bug Tracker
=========== ===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-tools/issues>`_. Bugs are tracked on `GitHub Issues
In case of trouble, please check there if your issue has already been reported. <https://github.com/OCA/account-financial-tools/issues>`_. In case of trouble, please
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback check there if your issue has already been reported. If you spotted it first,
`here <https://github.com/OCA/account-financial-tools/issues/new?body=module:%20base_vat_optional_vies%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. help us smashing it by providing a detailed and welcomed feedback.
Credits Credits
@ -60,6 +61,7 @@ Contributors
* Rafael Blasco <rafabn@antiun.com> * Rafael Blasco <rafabn@antiun.com>
* Antonio Espinosa <antonioea@antiun.com> * Antonio Espinosa <antonioea@antiun.com>
* Sergio Teruel <sergio.teruel@tecnativa.com>
Maintainer Maintainer

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# License AGPL-3: Antiun Ingenieria S.L. - Antonio Espinosa
# See README.rst file on addon root folder for more details
from . import models from . import models

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# License AGPL-3: Antiun Ingenieria S.L. - Antonio Espinosa # License AGPL-3: Tecnativa S.L. - Antonio Espinosa
# See README.rst file on addon root folder for more details # See README.rst file on addon root folder for more details
{ {
@ -16,8 +16,9 @@
'views/res_partner_view.xml', 'views/res_partner_view.xml',
], ],
'author': 'Antiun Ingeniería S.L., ' 'author': 'Antiun Ingeniería S.L., '
'Tecnativa,'
'Odoo Community Association (OCA)', 'Odoo Community Association (OCA)',
'website': 'http://www.antiun.com', 'website': 'http://www.tecnativa.com',
'license': 'AGPL-3', 'license': 'AGPL-3',
'images': [], 'images': [],
'installable': True, 'installable': True,

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# License AGPL-3: Antiun Ingenieria S.L. - Antonio Espinosa
# See README.rst file on addon root folder for more details # See README.rst file on addon root folder for more details
from . import res_partner from . import res_partner

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# License AGPL-3: Antiun Ingenieria S.L. - Antonio Espinosa # License AGPL-3: Tecnativa S.L. - Antonio Espinosa
# See README.rst file on addon root folder for more details # See README.rst file on addon root folder for more details
import logging import logging
@ -52,7 +52,7 @@ class ResPartner(models.Model):
vat_country = 'XX' vat_country = 'XX'
vat_number = vat vat_number = vat
if vat and re.match(r'[A-Za-z]{2}', vat): if vat and re.match(r'[A-Za-z]{2}', vat):
vat_country = vat[:2].upper() vat_country = vat[:2].lower()
vat_number = vat[2:].replace(' ', '') vat_number = vat[2:].replace(' ', '')
elif country: elif country:
vat_country = country vat_country = country
@ -89,7 +89,7 @@ class ResPartner(models.Model):
# Can not be sure that this VAT is signed up in VIES # Can not be sure that this VAT is signed up in VIES
data['vies_passed'] = False data['vies_passed'] = False
if res: if res:
vat = country_code + vat_number vat = country_code.upper() + vat_number
if self.vat != vat: if self.vat != vat:
data['vat'] = vat data['vat'] = vat
if data: if data:
@ -123,7 +123,7 @@ class ResPartner(models.Model):
if self.vies_passed: if self.vies_passed:
data['vies_passed'] = False data['vies_passed'] = False
if res: if res:
vat = country_code + vat_number vat = country_code.upper() + vat_number
if self.vat != vat: if self.vat != vat:
data['vat'] = vat data['vat'] = vat
if data: if data:

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# License AGPL-3: Antiun Ingenieria S.L. - Antonio Espinosa
# See README.rst file on addon root folder for more details
from . import test_res_partner from . import test_res_partner

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# License AGPL-3: Antiun Ingenieria S.L. - Antonio Espinosa # License AGPL-3: Tecnativa S.L. - Antonio Espinosa
# See README.rst file on addon root folder for more details # See README.rst file on addon root folder for more details
from openerp.tests.common import TransactionCase from openerp.tests.common import TransactionCase