summaryrefslogtreecommitdiff
path: root/addons/sms/models/mail_thread.py
diff options
context:
space:
mode:
authorThibault Delavallée <tde@odoo.com>2019-07-15 13:37:43 +0000
committerThibault Delavallée <tde@odoo.com>2019-07-18 09:19:04 +0000
commitac212ae65dccf8637a7636547aa07f77ddefb357 (patch)
treea324dc2da3631317882d6f9ad9ff1c2ac0952c63 /addons/sms/models/mail_thread.py
parent1bfdf9219d634f75e44b2b2440e14958080cd981 (diff)
[IMP] sms: improve composer behavior
PURPOSE Purpose of this commit is to add options and improve sms composer behavior. Followup of merge 4287481bf03fbb6539313ff657af0ca58e2895e7 . SPECIFICATIONS * mass mode: add an option to keep archives when doing mass sms. This mode is actually a _message_sms in batch using the note subtype to speedup the process; * improve _message_sms_schedule_mass to allow more fine-tuning of options when calling it; * do not block sending SMS in batch if some recipients are invalid. Indeed using notifications there will be traces of failed SMS; * avoid reload of form view; Linked to task 1925950 and 1935280 Part of PR #34864
Diffstat (limited to 'addons/sms/models/mail_thread.py')
-rw-r--r--addons/sms/models/mail_thread.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/addons/sms/models/mail_thread.py b/addons/sms/models/mail_thread.py
index 467a60127cd..36c5df282be 100644
--- a/addons/sms/models/mail_thread.py
+++ b/addons/sms/models/mail_thread.py
@@ -106,7 +106,7 @@ class MailThread(models.AbstractModel):
result[record.id] = {'partner': self.env['res.partner'], 'sanitized': False, 'number': False}
return result
- def _message_sms_schedule_mass(self, body='', template=False, active_domain=None):
+ def _message_sms_schedule_mass(self, body='', template=False, active_domain=None, **composer_values):
""" Shortcut method to schedule a mass sms sending on a recordset.
:param template: an optional sms.template record;
@@ -125,7 +125,14 @@ class MailThread(models.AbstractModel):
else:
composer_context['default_res_ids'] = self.ids
- composer = self.env['sms.composer'].with_context(**composer_context).create({})
+ create_vals = {
+ 'mass_force_send': False,
+ 'mass_keep_log': False,
+ }
+ if composer_values:
+ create_vals.update(composer_values)
+
+ composer = self.env['sms.composer'].with_context(**composer_context).create(create_vals)
return composer._action_send_sms()
def _message_sms_with_template(self, template=False, template_xmlid=False, template_fallback='', partner_ids=False, **kwargs):