Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda

In Odoo V11 (I know...need to upgrade soon) CE, I'm trying to automate a part of the recruitment process.

I'm using hr_recruitment_survey and I would like to automatically send new applicants an email with a link to the job interview survey with their specific response_id.

I know how to configure the email to be sent automatically, and the post in this link:

https://www\\.odoo\\.com/forum/help\\-1/interview\\-form\\-in\\-applicant\\-email\\-template\\-in\\-recruitment\\-module\\-131408

\\.\\.\\.makes\\ reference\\ to\\ the\\ correct\\ placeholder\\ to\\ use\\ to\\ pull\\ the\\ unique\\ response_id\\ \\(green\\ rectangle\\ in\\ image\\ below\\)\\ for\\ the\\ application\\ in\\ question,\\ but\\ it\\ will\\ only\\ work\\ if\\ the\\ 'Start\\ Interview'\\ button\\ has\\ been\\ clicked\\ once\\.

Can\\ I\\ create\\ an\\ automatic\\ action\\ that\\ will\\ call\\ this\\ function\\ when\\ a\\ new\\ application\\ is\\ created\\?

Alternatively,\\ can\\ I\\ inherit\\ the\\ hr\\.applicant\\ model\\ and\\ customize\\ it\\ so\\ that\\ 'response_id'\\ is\\ automatically\\ created\\ when\\ a\\ new\\ application\\ is\\ created\\?

If\\ either\\ of\\ the\\ above\\ options\\ is\\ possible,\\ I\\ would\\ appreciate\\ some\\ help\\ with\\ the\\ code\\ \\(I'm\\ just\\ a\\ self\\-taught\\ beginner\\)\\. \\ I've\\ made\\ some\\ attempts\\ borrowing\\ from the\\ code that\\ defines\\ 'action_start_survey',\\ but\\ I'm\\ really\\ just\\ stabbing\\ in\\ the\\ dark,\\ so\\ everything\\ failed\\.

Thanks\\ for\\ reading!

p\.s\.\ Apologies\ for\ the\ backslash\ attack\. \ I've\ run\ out\ of\ patience\ trying\ to\ fix\ it\. \ Boy\ is\ this\ forum\ software\ buggy!



Avatar
Buang
Penulis Jawaban Terbai

I figured out how to do this myself.

I made an automated action of the 'Execute several actions' type.  Here it is:

Here\ are\ the\ individual\ automated\ actions\ that\ make\ up\ the\ combined\ action:

Calling\ the\ function\ to\ start\ the\ survey\ turned\ out\ to\ be\ very\ simple!

To\ send\ the\ email,\ I\ was\ trying\ use\ an\ automated\ action\ to\ send\ an\ email\ with\ the\ link\ to\ the\ survey\ directly,\ but\ I\ couldn't\ get\ the\ email\ template\ to\ pull\ the\ applicant's\ email\ address\ into\ the\ 'To'\ field,\ so\ it\ wouldn't\ send\.

I\ gave\ up\ eventually\ and\ used\ the\ built\-in\ feature\ where\ you\ can\ set\ an\ automated\ email\ to\ be\ sent\ to\ an\ applicant\ when\ their\ application\ is\ progressed\ to\ a\ particular\ stage\. \ I\ created\ a\ new\ stage\ just\ for\ this\ purpose\ and\ gave\ it\ the\ sequence\ '1',\ immediately\ after\ the\ first\ stage\ 'new'\ which\ has\ the\ sequence\ '0'\. \ The\ email\ template\ worked\ fine\ when\ triggered\ in\ this\ way,\ so\ I\ don't\ know\ what\ the\ problem\ with\ the\ 'Send\ Email'\ automated\ action\ was\.

The\ 'Applicant:\ RGQ\-Acknowledgement'\ template\ set\ in\ the\ automated\ email\ field\ above\ uses\ the\ following\ placeholder\ to\ get\ the\ correct\ survey\ response_id\ for\ the\ application\. \ Thanks\ to\ @VasystOM\ Technologies\ for\ this\ tip\.

h t t p://${object.survey_id.public_url.replace('http://','')}/${object.response_id.token}

The second part of the combined automated action simply updates the record by changing the 'state' (Stage) field to 'id' '4', which is the id of the 'survey sent' stage.

That's it.  Sure does save me a lot of time and it means the applicant get's to fill out their survey straight after submitting their application, so they are less likely to forget about it.


Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
2
Jun 25
2408
0
Sep 24
1377
0
Mei 24
26
1
Apr 24
4761
0
Mar 24
1677