summaryrefslogtreecommitdiff
path: root/addons/calendar_sms
diff options
context:
space:
mode:
authorPierre Rousseau <pro@odoo.com>2019-05-24 11:43:53 +0000
committerThibault Delavallée <tde@odoo.com>2019-07-15 08:08:49 +0000
commita1087e301122eea626ed30f34198de4666a81bdf (patch)
tree12791eaf5e9822f076a94c8297f713a6a007646f /addons/calendar_sms
parent54f5c6c70ffe4bb8020a0106d3b8fde0ca34a45b (diff)
[IMP] calendar_sms, hr_presence: use sms template and its API when sending SMS
Purpose of this commit is to include SMS templates and the new sms messaging API and methods in calendar_sms and hr_presence. Templates allow people to customize the content of sent SMS. New SMS messaging API allows to track notification status when sending SMS. Related to task 1922163 Linked to PR #33510
Diffstat (limited to 'addons/calendar_sms')
-rw-r--r--addons/calendar_sms/__manifest__.py1
-rw-r--r--addons/calendar_sms/data/sms_data.xml10
-rw-r--r--addons/calendar_sms/models/calendar.py8
3 files changed, 17 insertions, 2 deletions
diff --git a/addons/calendar_sms/__manifest__.py b/addons/calendar_sms/__manifest__.py
index 70156156a8a..f91a362bbe2 100644
--- a/addons/calendar_sms/__manifest__.py
+++ b/addons/calendar_sms/__manifest__.py
@@ -9,6 +9,7 @@
'version': '1.0',
'depends': ['calendar', 'sms'],
'data': [
+ 'data/sms_data.xml',
'views/calendar_views.xml',
],
'application': False,
diff --git a/addons/calendar_sms/data/sms_data.xml b/addons/calendar_sms/data/sms_data.xml
new file mode 100644
index 00000000000..8016fd429fe
--- /dev/null
+++ b/addons/calendar_sms/data/sms_data.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" ?>
+<odoo>
+ <data noupdate="1">
+ <record id="sms_template_data_calendar_reminder" model="sms.template">
+ <field name="name">Calendar Event: Reminder</field>
+ <field name="model_id" ref="calendar.model_calendar_event"/>
+ <field name="body">Event reminder: ${object.name} on ${object.start_datetime or object.start_date}</field>
+ </record>
+ </data>
+</odoo>
diff --git a/addons/calendar_sms/models/calendar.py b/addons/calendar_sms/models/calendar.py
index 0ad5bb3fb31..9071a0181a3 100644
--- a/addons/calendar_sms/models/calendar.py
+++ b/addons/calendar_sms/models/calendar.py
@@ -20,8 +20,12 @@ class CalendarEvent(models.Model):
def _do_sms_reminder(self):
""" Send an SMS text reminder to attendees that haven't declined the event """
for event in self:
- sms_msg = _("Event reminder: %s on %s.") % (event.name, event.start_datetime or event.start_date)
- event._message_sms(sms_msg)
+ event._message_sms_with_template(
+ template_xmlid='calendar_sms.sms_template_data_calendar_reminder',
+ template_fallback=_("Event reminder: %s on %s.") % (event.name, event.start_datetime or event.start_date),
+ partner_ids=self._sms_get_default_partners().ids,
+ put_in_queue=False
+ )
class CalendarAlarm(models.Model):