[IMP] mail

bzr revid: chm@openerp.com-20120928145147-3g5iptsnknvbh4py
This commit is contained in:
Christophe Matthieu 2012-09-28 16:51:47 +02:00
parent 20f6a39089
commit 24aea1657c
4 changed files with 29 additions and 17 deletions

View File

@ -307,7 +307,6 @@ class mail_message(osv.Model):
if context and context.get('message_loaded'):
domain += [['id','not in',context.get('message_loaded')]];
limit = limit or self._message_read_limit
context = context or {}
if not ids:
@ -474,6 +473,9 @@ class mail_message(osv.Model):
""" Add the related record followers to the destination partner_ids.
Call mail_notification.notify to manage the email sending
"""
print "notification ?"
message = self.browse(cr, uid, newid, context=context)
partners_to_notify = set([])
# message has no subtype_id: pure log message -> no partners, no one notified
@ -495,11 +497,14 @@ class mail_message(osv.Model):
self.write(cr, SUPERUSER_ID, [newid], {'partner_ids': [(4, p_id) for p_id in missing_notified]}, context=context)
partners_to_notify |= extra_notified
if message.model=="res.partner" and message.res_id==message.author_id.id:
# add myself author if I wrote on my wall
# add myself if I wrote on my wall,
# unless remove myself author
if ((message.model=="res.partner" and message.res_id==message.author_id.id)):
self.write(cr, SUPERUSER_ID, [newid], {'partner_ids': [(4, message.author_id.id)]}, context=context)
# add myself if this message have a parent message and I recive parent message
# ! subtype_id: pure log message => do this in read_message
# or (message.parent_id and self.pool.get('mail.notification').search(cr, uid, [('partner_id','=',message.author_id.id),('message_id','=',message.parent_id)])):
else:
# unless remove myself author
self.write(cr, SUPERUSER_ID, [newid], {'partner_ids': [(3, message.author_id.id)]}, context=context)
self.pool.get('mail.notification').notify(cr, uid, list(partners_to_notify), newid, context=context)

View File

@ -218,6 +218,10 @@
.openerp li.oe_mail_thread_msg.oe_mail_read div {
background-color: #F0F0F0;
}
.openerp li.oe_mail_thread_msg.oe_mail_read li.oe_mail_thread_msg.oe_mail_unread,
.openerp li.oe_mail_thread_msg.oe_mail_read li.oe_mail_thread_msg.oe_mail_unread div {
background-color: #F6F6F6;
}
.openerp li.oe_mail_thread_msg > div:after {
content: "";

View File

@ -485,12 +485,12 @@ openerp.mail = function(session) {
},
/**
* Override-hack of do_action: automatically reload the chatter.
* Override-hack of do_action: automatically load message on the chatter.
* Normally it should be called only when clicking on 'Post/Send'
* in the composition form. */
do_action: function(action, on_close) {
//TDE: TODO: instead of reloading, push the message ?
this.message_clean();
console.log("do_action");
this.message_fetch();
if (this.compose_message_widget) {
this.compose_message_widget.refresh({
@ -513,11 +513,7 @@ openerp.mail = function(session) {
var composition_node = this.$('div.oe_mail_thread_action');
composition_node.empty();
var compose_done = this.compose_message_widget.appendTo(composition_node)
.then(function(){
self.$("button.oe_mail_compose_message_button_send").mouseup(function(){
self.browse_thread({'top_thread':1}).message_fetch();
});
});
.then(function(){ self.message_post_wizard(); });
return compose_done;
},
@ -526,11 +522,6 @@ openerp.mail = function(session) {
return this.compose_message_widget.refresh(context);
},
/** Clean the thread */
message_clean: function() {
this.$('ul.oe_mail_thread_display').empty();
},
/** Fetch messages
* @param {Bool} initial_mode: initial mode: try to use message_data or
* message_ids, if nothing available perform a message_read; otherwise
@ -749,6 +740,18 @@ openerp.mail = function(session) {
return false;
},
/*post a message and flatch the message with wizard form*/
message_post_wizard: function () {
var self=this;
self.$("button.oe_mail_compose_message_button_send").mouseup(function(){
window.setTimeout(function(){
self.$('.oe_mail_msg_content textarea').val("");
self.browse_thread({'top_thread':1}).message_fetch();
},250);
console.log("todo : load after write on wizard !");
});
},
/** Action: 'shows more' to fetch new messages */
do_message_fetch_more: function (event) {
event.stopPropagation();

View File

@ -149,7 +149,7 @@
<li t-if="options.show_record_name and record.record_name and record.subject and options.thread_level > 0">
<a t-attf-href="#model=#{record.model}&amp;id=#{record.res_id}"><t t-raw="record.record_name"/></a>
</li>
<!--li t-if="record.author_id"><a t-attf-href="#model=res.partner&amp;id=#{record.author_id[0]}"><t t-raw="record.author_id[1]"/></a></li-->
<li t-if="record.author_id"><a t-attf-href="#model=res.partner&amp;id=#{record.author_id[0]}"><t t-raw="record.author_id[1]"/></a></li>
<li><span t-att-title="record.date"><t t-raw="record.timerelative"/></span></li>
<t t-call="mail.thread.message.vote"/>
<li t-if="record.attachment_ids.length > 0">