From 6a2243ed788a57dc67e3873b74bfbf9af4364cb1 Mon Sep 17 00:00:00 2001 From: "robin.keunen" Date: Tue, 7 May 2019 10:11:20 +0200 Subject: [PATCH] [FIX] partner_email_unique: duplicating partner sets empty email --- partner_email_unique/models/res_partner.py | 4 +++- partner_email_unique/tests/test_res_partner_email.py | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/partner_email_unique/models/res_partner.py b/partner_email_unique/models/res_partner.py index c45507bb2..465c403e6 100644 --- a/partner_email_unique/models/res_partner.py +++ b/partner_email_unique/models/res_partner.py @@ -3,7 +3,7 @@ # Robin Keunen # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from openerp import models, api, _ +from openerp import models, api, _, fields from openerp.exceptions import ValidationError from openerp.tools import config @@ -11,6 +11,8 @@ from openerp.tools import config class ResPartner(models.Model): _inherit = "res.partner" + email = fields.Char(copy=False) + @api.multi @api.constrains('email') def _check_email(self): diff --git a/partner_email_unique/tests/test_res_partner_email.py b/partner_email_unique/tests/test_res_partner_email.py index 0c4a11d9c..00b3c4a09 100644 --- a/partner_email_unique/tests/test_res_partner_email.py +++ b/partner_email_unique/tests/test_res_partner_email.py @@ -37,3 +37,6 @@ class TestResPartnerEmailUnique(common.SavepointCase): # Empty email addresses don't raise self.partner1.email = False self.partner2.email = False + + def test_copy_does_not_raise_duplicate_email_error(self): + self.partner1.copy()