diff --git a/base_vat_sanitized/README.rst b/base_vat_sanitized/README.rst index ec5552115..31aad2a60 100644 --- a/base_vat_sanitized/README.rst +++ b/base_vat_sanitized/README.rst @@ -1,5 +1,5 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png + :target: https://www.gnu.org/licenses/agpl :alt: License: AGPL-3 ================== @@ -8,11 +8,6 @@ Base VAT Sanitized This module adds a technical field *sanitized_vat* on partners that stores the VAT number without spaces and with letters in uppercase. It is useful for other modules that need to match partners on VAT number, such as the *base_business_document_import* module for example. -Configuration -============= - -No configuration is needed. - Usage ===== @@ -20,7 +15,7 @@ This module doesn't bring any visible feature for the users. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/134/10.0 + :target: https://runbot.odoo-community.org/runbot/134/11.0 Bug Tracker @@ -29,7 +24,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, -help us smashing it by providing a detailed and welcomed feedback. +help us smash it by providing detailed and welcomed feedback. Credits ======= diff --git a/base_vat_sanitized/__init__.py b/base_vat_sanitized/__init__.py index cde864bae..31660d6a9 100644 --- a/base_vat_sanitized/__init__.py +++ b/base_vat_sanitized/__init__.py @@ -1,3 +1,3 @@ -# -*- coding: utf-8 -*- +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from . import models diff --git a/base_vat_sanitized/__manifest__.py b/base_vat_sanitized/__manifest__.py index 05e4d161c..538adc3a3 100644 --- a/base_vat_sanitized/__manifest__.py +++ b/base_vat_sanitized/__manifest__.py @@ -1,16 +1,15 @@ -# -*- coding: utf-8 -*- -# © 2016 Akretion (http://www.akretion.com) -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +# Copyright 2016 Akretion (http://www.akretion.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). # @author Alexis de Lattre { 'name': 'Base VAT Sanitized', - 'version': '10.0.1.0.0', + 'version': '11.0.1.0.0', 'category': 'Hidden/Dependency', 'license': 'AGPL-3', 'summary': 'Adds field sanitized_vat on partners', 'author': 'Akretion,Odoo Community Association (OCA)', - 'website': 'http://www.akretion.com', + 'website': 'https://github.com/OCA/partner-contact', 'depends': ['base_vat'], 'installable': True, } diff --git a/base_vat_sanitized/models/__init__.py b/base_vat_sanitized/models/__init__.py index f261da797..c6cc3b329 100644 --- a/base_vat_sanitized/models/__init__.py +++ b/base_vat_sanitized/models/__init__.py @@ -1,3 +1,3 @@ -# -*- coding: utf-8 -*- +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from . import res_partner diff --git a/base_vat_sanitized/models/res_partner.py b/base_vat_sanitized/models/res_partner.py index d1fe5dfa2..9155a1f09 100644 --- a/base_vat_sanitized/models/res_partner.py +++ b/base_vat_sanitized/models/res_partner.py @@ -1,25 +1,25 @@ -# -*- coding: utf-8 -*- -# © 2016 Akretion (http://www.akretion.com) -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +# Copyright 2016 Akretion (http://www.akretion.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). # @author Alexis de Lattre -from odoo import models, fields, api import re +from odoo import api, fields, models + class ResPartner(models.Model): _inherit = 'res.partner' sanitized_vat = fields.Char( - compute='compute_sanitized_vat', string='Sanitized TIN', + compute='_compute_sanitized_vat', string='Sanitized TIN', store=True, readonly=True, help='TIN in uppercase without spaces nor special caracters.') + @classmethod def _sanitize_vat(self, vat): return vat and re.sub(r'\W+', '', vat).upper() or False - @api.multi @api.depends('vat') - def compute_sanitized_vat(self): + def _compute_sanitized_vat(self): for partner in self: partner.sanitized_vat = self._sanitize_vat(partner.vat) diff --git a/base_vat_sanitized/tests/__init__.py b/base_vat_sanitized/tests/__init__.py index ee615d406..2c8354d28 100644 --- a/base_vat_sanitized/tests/__init__.py +++ b/base_vat_sanitized/tests/__init__.py @@ -1,3 +1,3 @@ -# -*- coding: utf-8 -*- +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from . import test_vat diff --git a/base_vat_sanitized/tests/test_vat.py b/base_vat_sanitized/tests/test_vat.py index faad406d3..366ae2d12 100644 --- a/base_vat_sanitized/tests/test_vat.py +++ b/base_vat_sanitized/tests/test_vat.py @@ -1,6 +1,5 @@ -# -*- coding: utf-8 -*- -# © 2016 Akretion (http://www.akretion.com) -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +# Copyright 2016 Akretion (http://www.akretion.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). # @author Alexis de Lattre from odoo.tests.common import TransactionCase