Browse Source

[IMP] change mail_archive module for show only sent/recipient messages

pull/22/head
x620 9 years ago
parent
commit
c67b8c22f3
  1. 2
      mail_archives/__init__.py
  2. 2
      mail_archives/__openerp__.py
  3. 1
      mail_archives/models/__init__.py
  4. 21
      mail_archives/static/src/js/archives.js

2
mail_archives/__init__.py

@ -1,3 +1 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from . import models

2
mail_archives/__openerp__.py

@ -13,7 +13,7 @@
'currency': 'EUR', 'currency': 'EUR',
"depends": [ "depends": [
"mail_base"
"mail_sent",
], ],
"data": [ "data": [

1
mail_archives/models/__init__.py

@ -1 +0,0 @@
# -*- coding: utf-8 -*-

21
mail_archives/static/src/js/archives.js

@ -35,7 +35,20 @@ base_obj.MailTools.include({
set_channel_flags: function(data, msg){ set_channel_flags: function(data, msg){
this._super.apply(this, arguments); this._super.apply(this, arguments);
msg.is_archive = true;
// Get recipients ids
var recipients_ids = [];
for (var i = 0; i < data.partner_ids.length; i++){
recipients_ids.push(data.partner_ids[i][0]);
}
// If author or recipient
if (
(data.sent && data.author_id[0] == session.partner_id)
|| (recipients_ids.indexOf(session.partner_id) != -1)
) {
msg.is_archive = true;
}
return msg; return msg;
}, },
@ -45,7 +58,11 @@ base_obj.MailTools.include({
}, },
get_domain: function(channel){ get_domain: function(channel){
return (channel.id === "channel_archive") ? [] : this._super.apply(this, arguments);
return (channel.id === "channel_archive") ? [
'|', ['partner_ids', 'in', [openerp.session.partner_id]],
'&', ['sent', '=', true],
['author_id.user_ids', 'in', [openerp.session.uid]]
] : this._super.apply(this, arguments);
} }
}); });

Loading…
Cancel
Save