Skip to content
Permalink
Browse files

[IMP] hr_presence: use sms template

  • Loading branch information...
pro-odoo committed Apr 24, 2019
1 parent 40855d3 commit b79ffb4252995de1247fcae09e7a7ab2c5c8b358
@@ -22,6 +22,7 @@
'data/ir_actions_server.xml',
'views/hr_employee_views.xml',
'data/mail_data.xml',
'data/sms_template_data.xml'
],
'demo': [],
'installable': True,
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record id="sms_template_presence" model="sms.template">
<field name="name">Presence: Contact Employee</field>
<field name="model_id" ref="hr.model_hr_employee"/>
<field name="body">Exception made if there was a mistake of ours, it seems that you are not at your office and there is not request of leaves from you.
Please, take appropriate measures in order to carry out this work absence.
Do not hesitate to contact your manager or the human resource department.</field>
</record>
</data>
</odoo>
@@ -128,16 +128,14 @@ def action_send_sms(self):
raise UserError(_("You don't have the right to do this. Please contact an Administrator."))
if not self.mobile_phone:
raise UserError(_("There is no professional phone for this employee."))
body = _("""Exception made if there was a mistake of ours, it seems that you are not at your office and there is not request of leaves from you.
Please, take appropriate measures in order to carry out this work absence.
Do not hesitate to contact your manager or the human resource department.""")
template = self.env.ref('hr_presence.sms_template_presence', False)
return {
"type": "ir.actions.act_window",
"res_model": "sms.compose.message",
"view_mode": 'form',
"context": {
'active_id': self.id,
'default_content': body,
'default_template_id': template.id if template else False,
'default_recipient_ids': [(0, False, {
'partner_id': self.user_partner_id.id if self.user_partner_id else False,
'number': self.mobile_phone

0 comments on commit b79ffb4

Please sign in to comment.
You can’t perform that action at this time.