[REM] hr_recruitment: remove broadcast of new employees on hardcoded channel

This is specific and updating the content is not easy for non technical
people. As same result can be achieved with a server action based on
employee creation it has been decided to remove the broadcast, and therefore
the template and code linked to it.

This commit is linked to task ID 1843122 (and 1868112) and to PR #25295
(and #25889).
This commit is contained in:
Hetashree Chauhan
2018-07-24 15:33:22 +02:00
committed by Thibault Delavallée
parent 323eb1861b
commit d543733093
3 changed files with 0 additions and 37 deletions
@@ -282,25 +282,6 @@
<field name="lang">${object.partner_id.lang or ''}</field>
</record>
<record id="email_template_data_applicant_employee" model="mail.template">
<field name="name">Applicant: Welcome new employee</field>
<field name="model_id" ref="hr.model_hr_employee"/>
<field name="subject">Welcome ${object.name} </field>
<field name="body_html" type="html">
<div>
Hello all,<br/><br/>
I’m very pleased to announce that <strong> ${object.name} </strong> will be
joining us as a ${object.job_id.name}
%if object.department_id:
in ${object.department_id.name}.
%endif
<br/><br/>
Please welcome him/her and help him/her finding his/her marks.
</div></field>
</record>
<!-- Resource(type_id) -->
<record model="hr.recruitment.degree" id="degree_graduate">
<field name="name">Graduate</field>
<field name="sequence">1</field>
@@ -21,20 +21,3 @@ class HrEmployee(models.Model):
def _search_newly_hired_employee(self, operator, value):
applicants = self.env['hr.applicant'].search([('job_id.state', '=', 'recruit')])
return [('id', 'in', applicants.ids)]
@api.multi
def _broadcast_welcome(self):
""" Broadcast the welcome message to all users in the employee company. """
self.ensure_one()
IrModelData = self.env['ir.model.data']
channel_all_employees = IrModelData.xmlid_to_object('mail.channel_all_employees')
template_new_employee = IrModelData.xmlid_to_object('hr_recruitment.email_template_data_applicant_employee')
if template_new_employee:
MailTemplate = self.env['mail.template']
body_html = MailTemplate.render_template(template_new_employee.body_html, 'hr.employee', self.id)
subject = MailTemplate.render_template(template_new_employee.subject, 'hr.employee', self.id)
channel_all_employees.message_post(
body=body_html, subject=subject,
subtype='mail.mt_comment',
notif_layout='mail.mail_notification_light')
return True
@@ -449,7 +449,6 @@ class Applicant(models.Model):
applicant.job_id.message_post(
body=_('New Employee %s Hired') % applicant.partner_name if applicant.partner_name else applicant.name,
subtype="hr_recruitment.mt_job_applicant_hired")
employee._broadcast_welcome()
else:
raise UserError(_('You must define an Applied Job and a Contact Name for this applicant.'))