Browse Source

[FIX] partner_vat_unique: Do not copy vat field

14.0
Sergio Teruel 5 years ago
committed by newtratip
parent
commit
be1e6ea435
  1. 14
      partner_vat_unique/i18n/partner_vat_unique.pot
  2. 4
      partner_vat_unique/models/res_partner.py
  3. 4
      partner_vat_unique/tests/test_vat_unique.py

14
partner_vat_unique/i18n/partner_vat_unique.pot

@ -19,7 +19,19 @@ msgid "Contact"
msgstr ""
#. module: partner_vat_unique
#: code:addons/partner_vat_unique/models/res_partner.py:27
#: model:ir.model.fields,field_description:partner_vat_unique.field_res_partner__vat
#: model:ir.model.fields,field_description:partner_vat_unique.field_res_users__vat
msgid "Tax ID"
msgstr ""
#. module: partner_vat_unique
#: model:ir.model.fields,help:partner_vat_unique.field_res_partner__vat
#: model:ir.model.fields,help:partner_vat_unique.field_res_users__vat
msgid "The Tax Identification Number. Complete it if the contact is subjected to government taxes. Used in some legal statements."
msgstr ""
#. module: partner_vat_unique
#: code:addons/partner_vat_unique/models/res_partner.py:29
#, python-format
msgid "The VAT %s already exists in another partner."
msgstr ""

4
partner_vat_unique/models/res_partner.py

@ -1,7 +1,7 @@
# Copyright 2017 Grant Thornton Spain - Ismael Calvo <ismael.calvo@es.gt.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, models, _
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
from odoo.tools import config
@ -9,6 +9,8 @@ from odoo.tools import config
class ResPartner(models.Model):
_inherit = 'res.partner'
vat = fields.Char(copy=False)
@api.constrains('vat')
def _check_vat_unique(self):
for record in self:

4
partner_vat_unique/tests/test_vat_unique.py

@ -21,3 +21,7 @@ class TestVatUnique(SavepointCase):
'name': 'Second partner',
'vat': 'ESA12345674'
})
def test_duplicate_partner(self):
partner_copied = self.partner.copy()
self.assertFalse(partner_copied.vat)
Loading…
Cancel
Save