[IMP] Basic Wall system displaying all pushes messages.
bzr revid: tde@openerp.com-20120208170808-8bac1bnj53z4650u
This commit is contained in:
parent
5363de0632
commit
5561797ce8
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
$('<div class="oe_mail_msg">').html(render_res).appendTo(self.$element.find('div.oe_mail_comments'));
|
||||
});
|
||||
// this.timeout = setTimeout(this.proxy('fetch_messages'), 5000);
|
||||
},
|
||||
|
||||
do_comment: function () {
|
||||
var body_text = this.$element.find('textarea').val();
|
||||
return this.ds.call('message_append_note', [[this.view.datarecord.id], 'Reply comment', body_text, type='comment']).then(
|
||||
this.proxy('fetch_messages'));
|
||||
},
|
||||
});
|
||||
};
|
||||
|
|
|
@ -37,6 +37,12 @@
|
|||
</t>
|
||||
|
||||
<div t-name="WallView" class="oe_mail_wall">
|
||||
<div class="oe_mail_post_comment">
|
||||
<textarea rows="3" cols="15">Type your comment</textarea><br />
|
||||
<button type="button" class="oe_mail_action_comment">Post comment</button>
|
||||
</div>
|
||||
<div class="oe_mail_comments">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
Loading…
Reference in New Issue