diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index 6543dc63463..2ecdad5ceca 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -222,9 +222,13 @@ class mail_message(osv.osv): notification_ids = notification_obj.search(cr, uid, [('user_id', '=', uid)], context=context) notifications = notification_obj.browse(cr, uid, notification_ids, context=context) - # TODO / REMARK: classify based on res_model / res_id to have a 1_level hierarchy ? + msg_ids = [notification.message_id.id for notification in notifications] + msgs = self.read(cr, uid, msg_ids, context=context) + print msgs - return notifications + # TODO / REMARK: classify based on res_model / res_id to have a 1_level hierarchy ? + + return msgs #------------------------------------------------------ # E-Mail api diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 184f4fbada5..bd82399b88e 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -97,7 +97,44 @@ openerp.mail = function(session) { init: function() { this._super.apply(this, arguments); - alert('Cacaboudin !!'); + /* DataSets */ + this.ds_msg = new session.web.DataSet(this, 'mail.message'); + }, + + start: function() { + var self = this; + this._super.apply(this, arguments); + self.$element.find('button.oe_mail_action_comment').bind('click', function () { self.do_comment(); }); + this.ds_msg.call('get_pushed_messages', []).then( + this.proxy('display_records')); + }, + + stop: function () { + this._super(); + }, + + fetch_messages: function () { + return this.ds_msg.call('get_pushed_messages', []).then( + this.proxy('display_records')); + }, + + display_records: function (records) { + this.$element.find('div.oe_mail_comments').empty(); + var self = this; + _(records).each(function (record) { + var template = 'ThreadMsgView'; + var render_res = session.web.qweb.render(template, { + 'record': record, + }); + $('
+ +