[IMP] base: do not format email for partners not having email
Currently if a partner has a void email, its email_formatted field holds a value like "Raoul Grosbedon <False>" which is quite rarely considered as a valid email address. Minimal fix for this field is to return a void value if there is no email. Having a void return is easier to manipulate for callers in order to handle it. This commit is linked to task ID 1860049 and PR #25824.
This commit is contained in:
@@ -374,7 +374,10 @@ class Partner(models.Model):
|
||||
@api.depends('name', 'email')
|
||||
def _compute_email_formatted(self):
|
||||
for partner in self:
|
||||
partner.email_formatted = formataddr((partner.name or u"False", partner.email or u"False"))
|
||||
if partner.email:
|
||||
partner.email_formatted = formataddr((partner.name or u"False", partner.email or u"False"))
|
||||
else:
|
||||
partner.email_formatted = ''
|
||||
|
||||
@api.depends('is_company')
|
||||
def _compute_company_type(self):
|
||||
|
||||
Reference in New Issue
Block a user