diff --git a/mail_sent/models.py b/mail_sent/models.py index 82377cf..a77c2ae 100644 --- a/mail_sent/models.py +++ b/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', 'partner_ids') + @api.depends('author_id', 'needaction_partner_ids') def _get_sent(self): self_sudo = self.sudo() - self_sudo.sent = len(self_sudo.partner_ids) > 1 \ - or len(self_sudo.partner_ids) == 1 \ - and self_sudo.author_id \ - and self_sudo.partner_ids[0].id != self_sudo.author_id.id + self_sudo.sent = len(self_sudo.needaction_partner_ids) > 1 \ + or len(self_sudo.needaction_partner_ids) == 1 \ + and self_sudo.author_id \ + and self_sudo.needaction_partner_ids[0].id != self_sudo.author_id.id @api.multi def message_format(self): @@ -22,7 +22,7 @@ class MailMessage(models.Model): message_index = {message['id']: message for message in message_values} for item in self: msg = message_index.get(item.id) - if msg and item._uid == item.author_id.user_ids.id: + if msg: msg['sent'] = item.sent return message_values diff --git a/mail_sent/static/src/js/sent.js b/mail_sent/static/src/js/sent.js index cd576fb..cf185e2 100644 --- a/mail_sent/static/src/js/sent.js +++ b/mail_sent/static/src/js/sent.js @@ -26,7 +26,7 @@ base_obj.MailTools.include({ set_channel_flags: function(data, msg){ this._super.apply(this, arguments); - if (data.sent) { + if (data.sent && data.author_id[0] == session.partner_id && data.partner_ids.length > 0) { msg.is_sent = true; } return msg;