[FIX] hr_recruitment: strip emails
- Create 2 applications with the following emails: 'test@test.com' 'test@test.com ' The 'Applications' stat button doesn't match the 2 applications. Since `_compute_application_count` uses a `read_group` for performance reason, we choose to strip the value at create and write for the sake of simplicity. opw-2189965 closes odoo/odoo#45613 X-original-commit: 00cfc324134b289417ba25373d472ba7cce4c78f Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
@@ -275,12 +275,16 @@ class Applicant(models.Model):
|
||||
self = self.with_context(default_department_id=vals.get('department_id'))
|
||||
if vals.get('user_id'):
|
||||
vals['date_open'] = fields.Datetime.now()
|
||||
if vals.get('email_from'):
|
||||
vals['email_from'] = vals['email_from'].strip()
|
||||
return super(Applicant, self).create(vals)
|
||||
|
||||
def write(self, vals):
|
||||
# user_id change: update date_open
|
||||
if vals.get('user_id'):
|
||||
vals['date_open'] = fields.Datetime.now()
|
||||
if vals.get('email_from'):
|
||||
vals['email_from'] = vals['email_from'].strip()
|
||||
# stage_id: track last stage before update
|
||||
if 'stage_id' in vals:
|
||||
vals['date_last_stage_update'] = fields.Datetime.now()
|
||||
|
||||
Reference in New Issue
Block a user