Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.
Module: SMS gateway
Entity: mail.thread
Compute Method: _compute_message_has_sms_error
| Inputs | Method | Outputs |
|---|---|---|
|
|
res = {}
if self.ids:
self.env.cr.execute("""
SELECT msg.res_id, COUNT(msg.res_id)
FROM mail_message msg
INNER JOIN mail_notification notif
ON notif.mail_message_id = msg.id
WHERE notif.notification_type = 'sms'
AND notif.notification_status = 'exception'
AND notif.author_id = %(author_id)s
AND msg.model = %(model_name)s
AND msg.res_id in %(res_ids)s
AND msg.message_type != 'user_notification'
GROUP BY msg.res_id
""", {'author_id': self.env.user.partner_id.id, 'model_name': self._name, 'res_ids': tuple(self.ids)})
- res.update(self._cr.fetchall())
+ res.update(self.env.cr.fetchall())
for record in self:
record.message_has_sms_error = bool(res.get(record._origin.id, 0))
|
|
