[FIX] Chatter / mail_followers widget: when no possibility to create or not in followers, hide composer in form view; when no possibility to edit, hide invite and (un)follow in form views.
bzr revid: tde@openerp.com-20120918094423-ox0x6lpeb83aj1v9
This commit is contained in:
@@ -615,12 +615,15 @@ openerp.mail = function(session) {
|
||||
// update domain
|
||||
var domain = this.options.domain.concat([['model', '=', this.view.model], ['res_id', '=', this.view.datarecord.id]]);
|
||||
// create and render Thread widget
|
||||
var show_header_compose = this.view.is_action_enabled('edit') ||
|
||||
(this.getParent().fields.message_is_follower && this.getParent().fields.message_is_follower.get_value());
|
||||
this.$el.find('div.oe_mail_recthread_main').empty();
|
||||
var thread = new mail.Thread(self, domain, this.options.context,
|
||||
{ 'thread_level': this.options.thread_level,
|
||||
'use_composer': true,
|
||||
'show_header_compose': show_header_compose,
|
||||
'use_composer': show_header_compose,
|
||||
'show_dd_delete': true,
|
||||
'show_reply_by_email': true });
|
||||
'show_reply_by_email': show_header_compose });
|
||||
return thread.appendTo(this.$el.find('div.oe_mail_recthread_main'));
|
||||
},
|
||||
});
|
||||
|
||||
@@ -89,7 +89,7 @@ openerp_mail_followers = function(session, mail) {
|
||||
|
||||
fetch_followers: function (value_) {
|
||||
this.value = value_;
|
||||
this.message_is_follower = this.getParent().fields.message_is_follower && this.getParent().fields.message_is_follower.get_value() || undefined;
|
||||
this.message_is_follower = this.getParent().fields.message_is_follower && this.getParent().fields.message_is_follower.get_value();
|
||||
return this.ds_follow.call('read', [value_, ['name', 'user_ids']]).pipe(this.proxy('display_followers'), this.proxy('display_generic'));
|
||||
},
|
||||
|
||||
@@ -126,8 +126,11 @@ openerp_mail_followers = function(session, mail) {
|
||||
display_buttons: function () {
|
||||
this.$('button.oe_mail_button_follow').hide();
|
||||
this.$('button.oe_mail_button_unfollow').hide();
|
||||
this.$('button.oe_mail_button_invite').hide();
|
||||
if (! this.view.is_action_enabled('edit')) return;
|
||||
this.$('button.oe_mail_button_invite').show();
|
||||
if (this.message_is_follower) { this.$('button.oe_mail_button_unfollow').show(); }
|
||||
else if (this.message_is_follow == false) { this.$('button.oe_mail_button_unfollow').hide(); }
|
||||
else if (this.message_is_follower == false) { this.$('button.oe_mail_button_follow').show(); }
|
||||
},
|
||||
|
||||
do_follow: function () {
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
-->
|
||||
<div t-name="mail.followers" class="oe_mail_recthread_aside oe_semantic_html_override">
|
||||
<div class="oe_mail_recthread_actions">
|
||||
<button type="button" class="oe_mail_button_invite">Invite</button>
|
||||
<button type="button" class="oe_mail_button_follow">Follow</button>
|
||||
<button type="button" class="oe_mail_button_unfollow oe_mail_button_mouseout">Following</button>
|
||||
<button type="button" class="oe_mail_button_invite">Invite</button>
|
||||
</div>
|
||||
<div class="oe_mail_recthread_followers">
|
||||
<t t-if="widget.options.title">
|
||||
|
||||
Reference in New Issue
Block a user