diff --git a/mail_base/static/src/js/base.js b/mail_base/static/src/js/base.js index c01c9cd..9a2bed8 100644 --- a/mail_base/static/src/js/base.js +++ b/mail_base/static/src/js/base.js @@ -241,8 +241,7 @@ var MailTools = core.Class.extend({ subtype_description: data.subtype_description, is_author: data.author_id && data.author_id[0] === session.partner_id, is_note: data.is_note, - is_system_notification: data.message_type === 'notification' && data.model === 'mail.channel' - || data.info === 'transient_message', + is_system_notification: data.message_type === 'notification' && data.model === 'mail.channel' || data.info === 'transient_message', attachment_ids: data.attachment_ids || [], subject: data.subject, email_from: data.email_from, @@ -1116,9 +1115,9 @@ function init () { }); // unsubscribe and then subscribe to the event, to avoid duplication of new messages - bus.off('notification') + bus.off('notification'); bus.on('notification', null, function(){ - chat_manager.mail_tools.on_notification.apply(chat_manager.mail_tools, arguments) + chat_manager.mail_tools.on_notification.apply(chat_manager.mail_tools, arguments); }); return session.rpc('/mail/client_action').then(function (result) { diff --git a/mail_sent/models.py b/mail_sent/models.py index 6e215e1..27bf2f0 100644 --- a/mail_sent/models.py +++ b/mail_sent/models.py @@ -5,11 +5,11 @@ from openerp import api, models, fields class MailMessage(models.Model): _inherit = 'mail.message' - sent = fields.Boolean('Sent', compute="_get_sent", help='Was message sent to someone', store=True) + sent = fields.Boolean('Sent', compute="_compute_sent", help='Was message sent to someone', store=True) @api.one @api.depends('author_id', 'partner_ids') - def _get_sent(self): + def _compute_sent(self): self_sudo = self.sudo() self_sudo.sent = len(self_sudo.partner_ids) > 1 \ or len(self_sudo.partner_ids) == 1 \ diff --git a/res_partner_mails_count/models.py b/res_partner_mails_count/models.py index 074e245..48f5328 100644 --- a/res_partner_mails_count/models.py +++ b/res_partner_mails_count/models.py @@ -5,27 +5,15 @@ from openerp import models, fields, api class ResPartner(models.Model): _inherit = 'res.partner' - mails_to = fields.Integer(compute="_mails_to") - mails_from = fields.Integer(compute="_mails_from") + mails_to = fields.Integer(compute="_compute_mails_to") + mails_from = fields.Integer(compute="_compute_mails_from") @api.multi - def _mails_to(self): - for r in self: - r._mails_to_one(self) - - @api.multi - def _mails_to_one(self): - self.ensure_one() + def _compute_mails_to(self): for r in self: r.mails_to = self.env['mail.message'].sudo().search_count([('partner_ids', 'in', r.id)]) @api.multi - def _mails_from(self): - for r in self: - r._mails_from_one(self) - - @api.multi - def _mails_from_one(self): - self.ensure_one() + def _compute_mails_from(self): for r in self: r.mails_from = self.env['mail.message'].sudo().search_count([('author_id', '=', r.id)])