From c93463369db891477b34a9523107ca5c5b37682d Mon Sep 17 00:00:00 2001 From: Sergio Teruel Date: Fri, 13 Sep 2019 11:02:44 +0200 Subject: [PATCH] [FIX] partner_vat_unique: Do not copy vat field --- partner_vat_unique/models/res_partner.py | 4 +++- partner_vat_unique/tests/test_vat_unique.py | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/partner_vat_unique/models/res_partner.py b/partner_vat_unique/models/res_partner.py index 725a6ee78..428b7bdb7 100644 --- a/partner_vat_unique/models/res_partner.py +++ b/partner_vat_unique/models/res_partner.py @@ -1,7 +1,7 @@ # Copyright 2017 Grant Thornton Spain - Ismael Calvo # 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: diff --git a/partner_vat_unique/tests/test_vat_unique.py b/partner_vat_unique/tests/test_vat_unique.py index 104303ee8..8eea96176 100644 --- a/partner_vat_unique/tests/test_vat_unique.py +++ b/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)