Browse Source

[FIX] unsubscribe and then subscribe to the event, to avoid duplication of new posts in base.js

[FIX] replace "needaction_partner_ids" to "partner_ids" in models.py
pull/12/head
x620 9 years ago
parent
commit
87aaf66674
  1. 2
      mail_base/static/src/js/base.js
  2. 8
      mail_sent/models.py

2
mail_base/static/src/js/base.js

@ -1099,6 +1099,8 @@ function init(){
var load_menu_id = ir_model.call("xmlid_to_res_id", ["mail.mail_channel_menu_root_chat"], {}, {shadow: true});
var load_action_id = ir_model.call("xmlid_to_res_id", ["mail.mail_channel_action_client_chat"], {}, {shadow: true});
// unsubscribe and then subscribe to the event, to avoid duplication of new messages
bus.off('notification');
bus.on('notification', null, chat_manager.mail_tools.on_notification);
return $.when(load_menu_id, load_action_id, load_channels, load_emojis).then(function (menu_id, action_id) {

8
mail_sent/models.py

@ -8,13 +8,13 @@ class MailMessage(models.Model):
sent = fields.Boolean('Sent', compute="_get_sent", help='Was message sent to someone', store=True)
@api.one
@api.depends('author_id', 'needaction_partner_ids')
@api.depends('author_id', 'partner_ids')
def _get_sent(self):
self_sudo = self.sudo()
self_sudo.sent = len(self_sudo.needaction_partner_ids) > 1 \
or len(self_sudo.needaction_partner_ids) == 1 \
self_sudo.sent = len(self_sudo.partner_ids) > 1 \
or len(self_sudo.partner_ids) == 1 \
and self_sudo.author_id \
and self_sudo.needaction_partner_ids[0].id != self_sudo.author_id.id
and self_sudo.partner_ids[0].id != self_sudo.author_id.id
@api.multi
def message_format(self):

Loading…
Cancel
Save