Browse Source
Merge pull request #736 from coopiteasy/9.0-partner-email-duplicate-partner
[FIX] partner_email_unique: duplicating partner sets empty email
9.0
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
6 additions and
1 deletions
-
partner_email_unique/models/res_partner.py
-
partner_email_unique/tests/test_res_partner_email.py
|
|
@ -3,7 +3,7 @@ |
|
|
|
# Robin Keunen <robin@coopiteasy.be> |
|
|
|
# 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): |
|
|
|
|
|
@ -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() |