[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
This commit is contained in:
Martin Trigaux 2016-07-05 09:55:27 +02:00
parent 8914de8c53
commit 64b0e67a38
No known key found for this signature in database
GPG Key ID: 7B0E288E7C0F83A7
1 changed files with 1 additions and 0 deletions

View File

@ -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, {