From e163fb702205443710f7531a2d6de15633e7a963 Mon Sep 17 00:00:00 2001 From: "robin.keunen" Date: Fri, 12 Apr 2019 16:07:59 +0200 Subject: [PATCH] [FIX] partner_email_unique: allow empty emails --- partner_email_unique/models/res_partner.py | 1 + partner_email_unique/tests/test_res_partner_email.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/partner_email_unique/models/res_partner.py b/partner_email_unique/models/res_partner.py index 7fde1488e..c45507bb2 100644 --- a/partner_email_unique/models/res_partner.py +++ b/partner_email_unique/models/res_partner.py @@ -22,6 +22,7 @@ class ResPartner(models.Model): domain = [ ('id', '!=', partner.id), ('email', '=', partner.email), + ('email', '!=', False), ] other_partners = self.search(domain) diff --git a/partner_email_unique/tests/test_res_partner_email.py b/partner_email_unique/tests/test_res_partner_email.py index 20ca7bdb2..0c4a11d9c 100644 --- a/partner_email_unique/tests/test_res_partner_email.py +++ b/partner_email_unique/tests/test_res_partner_email.py @@ -33,3 +33,7 @@ class TestResPartnerEmailUnique(common.SavepointCase): # Test can't create/modify partner with same email with self.assertRaises(ValidationError): self.partner2.email = 'same_email@test.com' + + # Empty email addresses don't raise + self.partner1.email = False + self.partner2.email = False