def _message_dict_get(self, cr, uid, msg, context=None):
""" Return a dict representation of the message browse record. """
+ child_nbr = len(msg.child_ids)
+ has_voted = False
+ vote_ids = self.pool.get('res.users').name_get(cr, uid, [user.id for user in msg.vote_user_ids], context=context)
+ for vote in vote_ids:
+ if vote[0] == uid:
+ has_voted = True
+ break
attachment_ids = [{'id': attach[0], 'name': attach[1]} for attach in self.pool.get('ir.attachment').name_get(cr, uid, [x.id for x in msg.attachment_ids], context=context)]
author_id = self.pool.get('res.partner').name_get(cr, uid, [msg.author_id.id], context=context)[0]
author_user_id = self.pool.get('res.users').name_get(cr, uid, [msg.author_id.user_ids[0].id], context=context)[0]
'author_user_id': author_user_id,
'partner_ids': partner_ids,
'child_ids': [],
+ 'child_nbr': child_nbr,
+ 'vote_user_ids': vote_ids,
+ 'has_voted': has_voted
}
- def message_read_tree_flatten(self, cr, uid, messages, current_level, level, context=None):
+ def message_read_tree_get_expandable(self, cr, uid, parent_message, last_message, domain=[], current_level=0, level=0, context=None):
+ """ . """
+ base_domain = [('id', '<', last_message['id'])]
+ if parent_message and current_level < level:
+ base_domain += [('parent_id', '=', parent_message['id'])]
+ elif parent_message:
+ base_domain += [('id', 'child_of', parent_message['id'])]
+ if domain:
+ base_domain += domain
+ extension = { 'type': 'expandable',
+ 'domain': base_domain,
+ 'thread_level': current_level,
+ 'context': context,
+ 'id': -1,
+ }
+ return extension
+
+ def message_read_tree_flatten(self, cr, uid, parent_message, messages, domain=[], level=0, current_level=0, context=None, limit=None):
""" Given a tree with several roots of following structure :
[ {'id': 1, 'child_ids': [
{'id': 11, 'child_ids': [...] },],
},
});
+
/**
* ------------------------------------------------------------
+ * Sidebar
+ * ------------------------------------------------------------
+ *
+ * Override of sidebar do_attachment_new method, to catch attachments added
+ * through the sidebar and show them in the Chatter composition form.
+ */
+
+ // session.web.Sidebar = session.web.Sidebar.extend({
+ // do_attachment_new: function(attachment) {
+ // this._super(attachment);
+ // var message_ids = this.getParent().fields.message_ids || undefined;
+ // if (! message_ids) { return; }
+ // var compose_message_widget = message_ids.thread.compose_message_widget;
+ // if (! compose_message_widget) { return; }
+ // compose_message_widget.attachments.push(attachment);
+ // compose_message_widget.display_attachments();
+ // },
+ // });
+
+ /**
+ * ------------------------------------------------------------
* ChatterUtils
* ------------------------------------------------------------
*
if (initial_mode && this.options.message_data) {
return this.message_display(this.options.message_data);
}
- return this.ds_message.call('message_read',
- [(initial_mode && this.options.message_ids) || false, fetch_domain, this.options.thread_level, fetch_context]
+ message_ids = initial_mode && this.options.message_ids != null && this.options.message_ids || false;
- return this.ds_message.call('message_read', [message_ids, fetch_domain, this.options.thread_level, undefined, fetch_context]
++ return this.ds_message.call('message_read', [message_ids, fetch_domain, this.options.thread_level, fetch_context]
).then(this.proxy('message_display'));
},