summaryrefslogtreecommitdiff
path: root/addons/sms/models/mail_followers.py
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/sms/models/mail_followers.py
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/sms/models/mail_followers.py')
-rw-r--r--addons/sms/models/mail_followers.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/addons/sms/models/mail_followers.py b/addons/sms/models/mail_followers.py
new file mode 100644
index 00000000..76be79b6
--- /dev/null
+++ b/addons/sms/models/mail_followers.py
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo import api, fields, models
+
+
+class Followers(models.Model):
+ _inherit = ['mail.followers']
+
+ def _get_recipient_data(self, records, message_type, subtype_id, pids=None, cids=None):
+ if message_type == 'sms':
+ if pids is None:
+ sms_pids = records._sms_get_default_partners().ids
+ else:
+ sms_pids = pids
+ res = super(Followers, self)._get_recipient_data(records, message_type, subtype_id, pids=pids, cids=cids)
+ new_res = []
+ for pid, cid, pactive, pshare, ctype, notif, groups in res:
+ if pid and pid in sms_pids:
+ notif = 'sms'
+ new_res.append((pid, cid, pactive, pshare, ctype, notif, groups))
+ return new_res
+ else:
+ return super(Followers, self)._get_recipient_data(records, message_type, subtype_id, pids=pids, cids=cids)