bzr revid: chm@openerp.com-20121003100952-e5v8ncgshra3uitc
This commit is contained in:
Christophe Matthieu 2012-10-03 12:09:52 +02:00
parent 775f0d32de
commit 40f04361c0
6 changed files with 27 additions and 17 deletions

View File

@ -134,6 +134,7 @@ class mail_message(osv.Model):
'subtype_id': fields.many2one('mail.message.subtype', 'Subtype'),
'vote_user_ids': fields.many2many('res.users', 'mail_vote', 'message_id', 'user_id', string='Votes',
help='Users that voted for this message'),
'is_private': fields.boolean('Private message'),
}
def _needaction_domain_get(self, cr, uid, context=None):
@ -150,6 +151,7 @@ class mail_message(osv.Model):
'date': lambda *a: fields.datetime.now(),
'author_id': lambda self, cr, uid, ctx={}: self._get_default_author(cr, uid, ctx),
'body': '',
'is_private': False,
}
#------------------------------------------------------
@ -221,7 +223,7 @@ class mail_message(osv.Model):
'unread': msg.unread and msg.unread['unread'] or False
}
def message_read_expandable(self, cr, uid, tree, result, message_loaded, domain, context, parent_id, limit):
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
@ -337,7 +339,7 @@ class mail_message(osv.Model):
result = sorted(result, key=lambda k: k['id'])
result = self.message_read_expandable(cr, uid, tree, result, message_loaded, domain, context, parent_id, limit)
result = self._message_read_expandable(cr, uid, tree, result, message_loaded, domain, context, parent_id, limit)
return result

View File

@ -87,7 +87,14 @@
<record id="action_mail_inbox_feeds" model="ir.actions.client">
<field name="name">Inbox</field>
<field name="tag">mail.wall</field>
<field name="params" eval="&quot;{'domain': [('notification_ids.partner_id.user_ids', 'in', [uid]),('unread', '=', True)],
<field name="params" eval="&quot;{'domain': [('is_private','=',True),('notification_ids.partner_id.user_ids', 'in', [uid]),('unread', '=', True)],
'context': {'default_model': 'res.users', 'default_res_id': uid} }&quot;"/>
</record>
<record id="action_mail_wall_feeds" model="ir.actions.client">
<field name="name">Wall</field>
<field name="tag">mail.wall</field>
<field name="params" eval="&quot;{'domain': [('is_private','=',False),('notification_ids.partner_id.user_ids', 'in', [uid]),('unread', '=', True)],
'context': {'default_model': 'res.users', 'default_res_id': uid} }&quot;"/>
</record>

View File

@ -18,15 +18,21 @@
<field name="action" ref="action_mail_inbox_feeds"/>
<field name="parent_id" ref="mail_feeds"/>
</record>
<record id="mail_inboxfeeds" model="ir.ui.menu">
<field name="name">Wall</field>
<field name="sequence" eval="11"/>
<field name="action" ref="action_mail_wall_feeds"/>
<field name="parent_id" ref="mail_feeds"/>
</record>
<record id="mail_archivesfeeds" model="ir.ui.menu">
<field name="name">Archives</field>
<field name="sequence" eval="11"/>
<field name="sequence" eval="12"/>
<field name="action" ref="action_mail_archives_feeds"/>
<field name="parent_id" ref="mail_feeds"/>
</record>
<record id="mail_sentfeeds" model="ir.ui.menu">
<field name="name">Sent</field>
<field name="sequence" eval="12"/>
<field name="sequence" eval="13"/>
<field name="action" ref="action_mail_sent_feeds"/>
<field name="parent_id" ref="mail_feeds"/>
</record>

View File

@ -1134,13 +1134,10 @@ openerp.mail = function(session) {
/** Clean and display the threads */
message_render: function (search) {
var domain = this.options.domain.concat(this.search_results['domain']);
var context = _.extend(this.options.context, search&&search.context ? search.context : {});
//console
this.thread = new mail.Thread(this, {
'domain' : domain,
'context' : context,
'domain' : this.options.domain.concat(this.search_results['domain']),
'context' : _.extend(this.options.context, this.search_results&&this.search_results['context'] ? this.search_results['context'] : {}),
'options': {
'thread' :{
'thread_level': this.options.thread_level,

View File

@ -149,7 +149,6 @@ openerp_mail_followers = function(session, mail) {
var self = this;
var node_user_list = this.$('ul.oe_mail_followers_display').empty();
this.$('div.oe_mail_recthread_followers h4').html(this.options.title + (records.length>=5 ? ' (' + records.length + ')' : '') );
console.log(records);
for(var i=0; i<records.length&&i<5; i++) {
var record=records[i];
record.avatar_url = mail.ChatterUtils.get_image(self.session, 'res.partner', 'image_small', record.id);
@ -200,7 +199,7 @@ openerp_mail_followers = function(session, mail) {
$(record).attr('checked','checked');
});
var context = new session.web.CompoundContext(this.build_context(), {});
return this.ds_model.call('message_subscribe_users', [[this.view.datarecord.id], undefined, undefined, context]).pipe(function(value_){
return this.ds_model.call('message_subscribe_users', [[this.view.datarecord.id], [this.session.uid], undefined, context]).pipe(function(value_){
self.read_value(value_);
if(!self.$('.oe_recthread_subtypes').is(":visible"))
self.display_subtypes(true);
@ -212,7 +211,7 @@ openerp_mail_followers = function(session, mail) {
$(record).attr('checked',false);
});
var context = new session.web.CompoundContext(this.build_context(), {});
return this.ds_model.call('message_unsubscribe_users', [[this.view.datarecord.id], undefined, context]).pipe(this.proxy('read_value'));
return this.ds_model.call('message_unsubscribe_users', [[this.view.datarecord.id], [this.session.uid], context]).pipe(this.proxy('read_value'));
},
do_update_subscription: function () {

View File

@ -111,8 +111,7 @@
<li class="placeholder-mail-vote"><t t-call="mail.thread.message.vote"/></li>
<li t-if="!widget.options.thread.display_on_flat and widget.unread" title="Read"><a class="oe_read oe_e">W</a></li>
<li t-if="!widget.options.thread.display_on_flat and !widget.unread" title="Set back to unread"><a class="oe_unread oe_e">h</a></li>
<li t-if="!widget.options.message.show_reply_by_email" title="Reply"><a class="oe_reply oe_e">)</a></li>
<li t-if="widget.options.message.show_reply_by_email"><a class="oe_reply_by_email oe_e" title="Reply by mail">)</a></li>
<li title="Quick reply"><a class="oe_reply oe_e">)</a></li>
<t t-if="(widget.options.message.show_reply || widget.options.message.show_reply_by_email || (widget.is_author and widget.options.message.show_dd_delete) || widget.type == 'email')">
<li>
<span class="oe_dropdown_toggle">
@ -124,7 +123,7 @@
<a href="#" class="oe_mail_msg_hide_type" t-attf-data-subtype='{widget.subtype}'>Hide '<t t-esc="widget.subtype"/>' for this document</a>
</li> -->
<li t-if="widget.options.message.show_reply" title="Reply"><a class="oe_reply oe_full_reply">Full reply</a></li>
<li t-if="widget.options.message.show_reply_by_email"><a class="oe_reply_by_email oe_full_reply" title="Reply by mail">Full reply</a></li>
<li t-if="widget.options.message.show_reply_by_email"><a class="oe_reply_by_email oe_full_reply" title="Reply by mail">Full reply by mail</a></li>
<li t-if="widget.type == 'email'"><a class="oe_mail_msg_details" t-attf-href="#model=mail.message&amp;id=#{widget.id}" >Details</a></li>
</ul>
</span>