[IMP] mail : invite follower wizard have 2 appearances
The wizard is the same object, but to add channel as follower, some fields was not required. Via the 'mail_invite_follower_channel_only' context key, the unrelevant fields are hidden.
This commit is contained in:
@@ -94,7 +94,14 @@ var Followers = form_common.AbstractField.extend({
|
||||
});
|
||||
|
||||
// event: click on 'invite' button, that opens the invite wizard
|
||||
this.$el.on('click', '.o_add_follower', self.on_invite_follower);
|
||||
this.$el.on('click', '.o_add_follower', function(e){
|
||||
e.preventDefault();
|
||||
self.on_invite_follower(false);
|
||||
});
|
||||
this.$el.on('click', '.o_add_follower_channel', function(e){
|
||||
e.preventDefault();
|
||||
self.on_invite_follower(true);
|
||||
});
|
||||
|
||||
// event: click on 'edit_subtype(pencil)' button to edit subscription
|
||||
this.$el.on('click', '.o_edit_subtype', self.on_edit_subtype);
|
||||
@@ -126,9 +133,8 @@ var Followers = form_common.AbstractField.extend({
|
||||
return self.fetch_subtypes(user_pid);
|
||||
},
|
||||
|
||||
on_invite_follower: function (event) {
|
||||
on_invite_follower: function (channel_only) {
|
||||
var self = this;
|
||||
event.preventDefault();
|
||||
var action = {
|
||||
type: 'ir.actions.act_window',
|
||||
res_model: 'mail.wizard.invite',
|
||||
@@ -140,6 +146,7 @@ var Followers = form_common.AbstractField.extend({
|
||||
context: {
|
||||
'default_res_model': this.view.dataset.model,
|
||||
'default_res_id': this.view.datarecord.id,
|
||||
'mail_invite_follower_channel_only': channel_only,
|
||||
},
|
||||
};
|
||||
this.do_action(action, {
|
||||
|
||||
@@ -54,6 +54,9 @@
|
||||
<li t-if="widget.view_is_editable" class="o_add_follower">
|
||||
<a href="#"> Add followers </a>
|
||||
</li>
|
||||
<li t-if="widget.view_is_editable" class="o_add_follower_channel">
|
||||
<a href="#"> Add Channels </a>
|
||||
</li>
|
||||
<li t-if="widget.view_is_editable and (widget.followers.length > 0)" class="divider"/>
|
||||
</t>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ from openerp import tools
|
||||
|
||||
|
||||
class Invite(models.TransientModel):
|
||||
""" Wizard to invite partners and make them followers. """
|
||||
""" Wizard to invite partners (or channels) and make them followers. """
|
||||
_name = 'mail.wizard.invite'
|
||||
_description = 'Invite wizard'
|
||||
|
||||
@@ -15,6 +15,8 @@ class Invite(models.TransientModel):
|
||||
user_name = self.env.user.name_get()[0][1]
|
||||
model = result.get('res_model')
|
||||
res_id = result.get('res_id')
|
||||
if self._context.get('mail_invite_follower_channel_only'):
|
||||
result['send_mail'] = False
|
||||
if 'message' in fields and model and res_id:
|
||||
model_name = self.env['ir.model'].search([('model', '=', self.pool[model]._name)]).name_get()[0][1]
|
||||
document_name = self.env[model].browse(res_id).name_get()[0][1]
|
||||
|
||||
@@ -13,16 +13,18 @@
|
||||
<field name="res_id" invisible="1"/>
|
||||
<field name="partner_ids" widget="many2many_tags_email"
|
||||
placeholder="Add contacts to notify..."
|
||||
context="{'force_email':True, 'show_email':True}"/>
|
||||
context="{'force_email':True, 'show_email':True}"
|
||||
invisible="context.get('mail_invite_follower_channel_only')"/>
|
||||
<field name="channel_ids" widget="many2many_tags"
|
||||
placeholder="Add channels to notify..."/>
|
||||
<field name="send_mail"/>
|
||||
placeholder="Add channels to notify..."
|
||||
invisible="not context.get('mail_invite_follower_channel_only')"/>
|
||||
<field name="send_mail" invisible="context.get('mail_invite_follower_channel_only')"/>
|
||||
<field name="message" attrs="{'invisible': [('send_mail','!=',True)]}" options="{'style-inline': true}" class="test_message"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button string="Add Followers"
|
||||
name="add_followers" type="object" class="btn-primary"/>
|
||||
<button string="Cancel" class="btn-default" special="cancel" />
|
||||
<button string="Cancel" class="btn-default" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
Reference in New Issue
Block a user