From 64b0e67a3869df3ffd112c2bcbc40d69b3f03c35 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 5 Jul 2016 09:55:27 +0200 Subject: [PATCH] [FIX] hr_recruitment: wrong id on composer When an applicant is moved from a stage to another, an email is sent to the applicant(s) if an email template is specified on the stage. The active_ids is correctly set in the compose context to be used by the send_mail method to send a message to all the applicants in the new stage. However, a potential active_id may be propagated from a previous action. This is the case when a user goes from a Job Position record to the list of applications and change the stage using the kanban view (active_id & active_ids is the id of the hr.job). The default_get method of mail.compose.message will use the active_id as the default value for the field res_id which is wrong as it is the id of another record). Forcing the value at False instead of ids[0] as it would not work in batch mode. The list of records is correctly used in send_mail anyway. Closes #12494 --- addons/hr_recruitment/hr_recruitment.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index 6721002e228..dba921fd8fc 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -459,6 +459,7 @@ class hr_applicant(osv.Model): if stage.template_id: # TDENOTE: probably factorize me in a message_post_with_template generic method FIXME compose_ctx = dict(context, + active_id=False, active_ids=ids) compose_id = self.pool['mail.compose.message'].create( cr, uid, {