From 38151f42c6d681a10984fe4d0efcd93c8ff00072 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 14 Feb 2020 09:08:43 +0000 Subject: [PATCH] [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) --- addons/hr_recruitment/models/hr_recruitment.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/hr_recruitment/models/hr_recruitment.py b/addons/hr_recruitment/models/hr_recruitment.py index 2a6fca31b05..9d2c83ef9ec 100644 --- a/addons/hr_recruitment/models/hr_recruitment.py +++ b/addons/hr_recruitment/models/hr_recruitment.py @@ -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()