Skip to content

Commit

Permalink
Merge PR #778 into 12.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Sep 13, 2019
2 parents 93d954c + c934633 commit 323016c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion partner_vat_unique/models/res_partner.py
@@ -1,14 +1,16 @@
# 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


class ResPartner(models.Model):
_inherit = 'res.partner'

vat = fields.Char(copy=False)

@api.constrains('vat')
def _check_vat_unique(self):
for record in self:
Expand Down
4 changes: 4 additions & 0 deletions partner_vat_unique/tests/test_vat_unique.py
Expand Up @@ -21,3 +21,7 @@ def test_duplicated_vat_creation(self):
'name': 'Second partner',
'vat': 'ESA12345674'
})

def test_duplicate_partner(self):
partner_copied = self.partner.copy()
self.assertFalse(partner_copied.vat)

0 comments on commit 323016c

Please sign in to comment.