[IMP] RecordThread widget: now handles options.

bzr revid: tde@openerp.com-20120515110702-x1u3kic6c16smpks
This commit is contained in:
Thibault Delavallée 2012-05-15 13:07:02 +02:00
parent 91d00a1980
commit 0571d171f8
1 changed files with 4 additions and 6 deletions

View File

@ -420,10 +420,12 @@ openerp.mail = function(session) {
// QWeb template to use when rendering the object
template: 'RecordThread',
init: function() {
init: function() {
this._super.apply(this, arguments);
this.see_subscribers = true;
this.thread = null;
this.params = this.get_definition_options();
this.params.thread_level = this.params.thread_level || 0;
// datasets
this.ds = new session.web.DataSet(this, this.view.model);
this.ds_users = new session.web.DataSet(this, 'res.users');
@ -464,12 +466,8 @@ openerp.mail = function(session) {
// create and render Thread widget
this.$element.find('div.oe_mail_recthread_left').empty();
if (this.thread) this.thread.destroy();
// hack: for groups and users
if (this.view.model == 'mail.group') thread_level = 1;
if (this.view.model == 'res.users') thread_level = 1;
else thread_level = 0;
this.thread = new mail.Thread(this, {'res_model': this.view.model, 'res_id': this.view.datarecord.id, 'uid': this.session.uid,
'thread_level': thread_level, 'show_post_comment': true, 'limit': 15});
'thread_level': this.params.thread_level, 'show_post_comment': true, 'limit': 15});
var thread_done = this.thread.appendTo(this.$element.find('div.oe_mail_recthread_left'));
return fetch_sub_done && thread_done;
},