summaryrefslogtreecommitdiff
path: root/addons/hr_recruitment
diff options
context:
space:
mode:
authorArnaud Baes <arb@odoo.com>2020-07-28 13:44:38 +0000
committerArnaud Baes <arb@odoo.com>2020-07-29 14:01:42 +0000
commite106c6af7f5a9daaf94cefb15c09dac186696e22 (patch)
tree34a312e42c79abd9480cb578233baa1b3976a3a2 /addons/hr_recruitment
parent8a6a4766d97df3b6b1d718bf12b8da242e532ed1 (diff)
[FIX] hr_recruitment: OdooBot assigned as Applicant Responsible
When someone is applying to any job position from the website ( via the `/website_form/` route ), the `hr.applicant` record is created by OdooBot, and in such case, the `_compute_user` method is never triggered as the field `user_id` (Responsible) already has self.env.uid as default value. This fix will in priority try to set a proper Responsible (if any is defined on the job position) via `_compute_user` and then assign `self.env.uid` if none is found. closes odoo/odoo#55146 X-original-commit: e9292cb424ec04823dbce964ad4532edc20190c6 Signed-off-by: Toufik Benjaa (tbe) <tbe@odoo.com>
Diffstat (limited to 'addons/hr_recruitment')
-rw-r--r--addons/hr_recruitment/models/hr_recruitment.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/addons/hr_recruitment/models/hr_recruitment.py b/addons/hr_recruitment/models/hr_recruitment.py
index d75b3c64b16..febde49d78e 100644
--- a/addons/hr_recruitment/models/hr_recruitment.py
+++ b/addons/hr_recruitment/models/hr_recruitment.py
@@ -115,7 +115,7 @@ class Applicant(models.Model):
company_id = fields.Many2one('res.company', "Company", compute='_compute_company', store=True, readonly=False, tracking=True)
user_id = fields.Many2one(
'res.users', "Responsible", compute='_compute_user',
- tracking=True, default=lambda self: self.env.uid, store=True, readonly=False)
+ tracking=True, store=True, readonly=False)
date_closed = fields.Datetime("Closed", compute='_compute_date_closed', store=True, index=True)
date_open = fields.Datetime("Assigned", readonly=True, index=True)
date_last_stage_update = fields.Datetime("Last Stage Update", index=True, default=fields.Datetime.now)
@@ -250,8 +250,8 @@ class Applicant(models.Model):
@api.depends('job_id')
def _compute_user(self):
- for applicant in self.filtered(lambda a: a.job_id):
- applicant.user_id = applicant.job_id.user_id.id
+ for applicant in self:
+ applicant.user_id = applicant.job_id.user_id.id or self.env.uid
@api.depends('partner_id')
def _compute_partner_phone_email(self):