From 33c299a4fc8284ff429ca52026d2ca63f03efd8f Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Tue, 27 Jun 2023 12:33:12 +0000 Subject: [PATCH] [FIX] hr_recruitment: Fix _track_template override in case of record deletion Part-of: odoo/odoo#105119 --- addons/hr_recruitment/models/hr_applicant.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_recruitment/models/hr_applicant.py b/addons/hr_recruitment/models/hr_applicant.py index 465178a241d..bd2eb463dc8 100644 --- a/addons/hr_recruitment/models/hr_applicant.py +++ b/addons/hr_recruitment/models/hr_applicant.py @@ -459,7 +459,7 @@ class Applicant(models.Model): applicant = self[0] # When applcant is unarchived, they are put back to the default stage automatically. In this case, # don't post automated message related to the stage change. - if 'stage_id' in changes and applicant.stage_id.template_id and not applicant._context.get('just_unarchived'): + if 'stage_id' in changes and applicant.exists() and applicant.stage_id.template_id and not applicant._context.get('just_unarchived'): res['stage_id'] = (applicant.stage_id.template_id, { 'auto_delete_keep_log': False, 'subtype_id': self.env['ir.model.data']._xmlid_to_res_id('mail.mt_note'),