[IMP]mail: domain/search

bzr revid: chm@openerp.com-20121003084029-jc184upr1i1bmk4l
This commit is contained in:
Christophe Matthieu 2012-10-03 10:40:29 +02:00
parent 1110b77e66
commit 775f0d32de
3 changed files with 15 additions and 17 deletions

View File

@ -224,6 +224,7 @@ class mail_message(osv.Model):
def message_read_expandable(self, cr, uid, tree, result, message_loaded, domain, context, parent_id, limit):
"""
create the expandable message for all parent message read
this function is used by message_read
"""
tree_not = []
@ -252,10 +253,12 @@ class mail_message(osv.Model):
'parent_id': id_msg,
'id': id_min
})
id_min=None
id_max=None
nb=0
if nb>0:
result.append({
'domain': [['id','>=',id_min],['parent_id','=',id_msg]],
'domain': [['id','>=',id_min],['id','<=',id_max],['parent_id','=',id_msg]],
'nb_messages': nb,
'type': 'expandable',
'parent_id': id_msg,
@ -294,7 +297,6 @@ class mail_message(osv.Model):
further parents
:return list: list of trees of messages
"""
message_loaded = context and context.get('message_loaded') or [0]
# don't read the message display by .js, in context message_loaded list

View File

@ -256,10 +256,10 @@ openerp.mail = function(session) {
default_res_id: 0,
default_parent_id: false }, options.context || {});
this.id = -1;
this.id = options.parameters.id || -1;
this.parent_id= options.parameters.parent_id || false;
this.nb_messages = options.parameters.nb_messages || 0;
this.type = options.parameters.type || false;
this.type = 'expandable';
// record options and data
this.parent_thread= parent.messages!= undefined ? parent : options.options.thread._parents[0] ;
@ -501,9 +501,6 @@ openerp.mail = function(session) {
} else {
self.destroy();
}
for(var i in this.thread.messages){
this.thread.messages[i].animated_destroy({fadeTime:0});
}
},
on_message_delete: function (event) {
@ -598,8 +595,8 @@ openerp.mail = function(session) {
display_vote: function () {
var self = this;
var vote_element = session.web.qweb.render('mail.thread.message.vote', {'widget': self});
self.$(".placeholder-mail-vote").empty();
self.$(".placeholder-mail-vote").html(vote_element);
self.$(".placeholder-mail-vote:first").empty();
self.$(".placeholder-mail-vote:first").html(vote_element);
},
});
@ -879,7 +876,7 @@ openerp.mail = function(session) {
fetch_domain = replace_domain ? replace_domain : this.domain;
fetch_context = replace_context ? replace_context : this.context;
fetch_context.message_loaded= [this.id||0].concat( self.options.thread._parents[0].get_child_ids() );
return this.ds_message.call('message_read', [ids, fetch_domain, (this.options.thread.thread_level+1), fetch_context, this.context.default_parent_id || undefined]
).then(this.proxy('switch_new_message'));
},
@ -945,11 +942,11 @@ openerp.mail = function(session) {
}
}
if(parent_newer)
message.insertAfter(parent_newer.$el);
else if(parent_older)
if(parent_older)
message.insertBefore(parent_older.$el);
else
else if(parent_newer)
message.insertAfter(parent_newer.$el);
else
message.prependTo(thread.list_ul);
return message
@ -1139,7 +1136,6 @@ openerp.mail = function(session) {
message_render: function (search) {
var domain = this.options.domain.concat(this.search_results['domain']);
var domain = _.extend(this.options.domain, search&&search.domain? search.domain : {});
var context = _.extend(this.options.context, search&&search.context ? search.context : {});
this.thread = new mail.Thread(this, {

View File

@ -104,7 +104,7 @@
</div>
<!-- default layout -->
<li t-name="mail.thread.message" t-attf-class="oe_mail oe_mail_thread_msg #{widget.unread?'oe_mail_unread':'oe_mail_read'}" t-attf-data-msg_id="{widget.id}">
<li t-name="mail.thread.message" t-attf-class="oe_mail oe_mail_thread_msg #{widget.unread?'oe_mail_unread':'oe_mail_read'}">
<div t-attf-class="oe_mail_msg_#{widget.type} oe_semantic_html_override">
<!-- message actions (read/unread, reply, delete...) -->
<ul class="oe_header">
@ -171,7 +171,7 @@
</li>
<!-- expandable message layout -->
<li t-name="mail.thread.expandable" t-attf-class="oe_mail oe_mail_thread_msg oe_mail_unread" t-attf-data-thread_id="{widget.id}">
<li t-name="mail.thread.expandable" class="oe_mail oe_mail_thread_msg oe_mail_unread">
<div t-attf-class="oe_mail_msg_#{widget.type} oe_semantic_html_override">
<div class="oe_mail_msg_content oe_mail_msg_more_message">
<a class="oe_mail_fetch_more">Load more messages <span t-if="widget.nb_messages>0">(<t t-raw="widget.nb_messages"/> messages not display)</span>...</a>