Browse Source
Merge pull request #730 from coopiteasy/9.0-partner-email-no-empty-unique
[FIX] partner_email_unique: allow empty emails
pull/736/head
Ronald Portier
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
5 additions and
0 deletions
-
partner_email_unique/models/res_partner.py
-
partner_email_unique/tests/test_res_partner_email.py
|
|
@ -22,6 +22,7 @@ class ResPartner(models.Model): |
|
|
|
domain = [ |
|
|
|
('id', '!=', partner.id), |
|
|
|
('email', '=', partner.email), |
|
|
|
('email', '!=', False), |
|
|
|
] |
|
|
|
other_partners = self.search(domain) |
|
|
|
|
|
|
|
|
|
@ -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 |