[ADD]: add an option in chatter 'display_log_button', that is true for employee action, and False for portal action

bzr revid: aja@tinyerp.com-20130920130449-8c5z33tgegftdxu3
This commit is contained in:
ajay javiya (OpenERP) 2013-09-20 18:34:49 +05:30
parent 5d7e287382
commit de52e90cfa
3 changed files with 22 additions and 3 deletions

View File

@ -1023,3 +1023,15 @@ class mail_message(osv.Model):
'message': warning_msg,
}
}
class ir_actions_client(osv.Model):
_inherit = 'ir.actions.client'
def check_message_security(self, cr, uid, context=None):
flag = False
group = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'base', 'group_user')
if group:
users = self.pool.get('res.groups').read(cr, uid, group[1], ['users'])['users']
flag = uid in users and True or False
return flag

View File

@ -1790,6 +1790,7 @@ openerp.mail = function (session) {
template: 'mail.record_thread',
init: function (parent, node) {
var self = this;
this._super.apply(this, arguments);
this.ParentViewManager = parent;
this.node = _.clone(node);
@ -1800,8 +1801,8 @@ openerp.mail = function (session) {
'read_action': 'unread',
'show_record_name': false,
'show_compact_message': 1,
'display_log_button' : false,
}, this.node.params);
if (this.node.attrs.placeholder) {
this.node.params.compose_placeholder = this.node.attrs.placeholder;
}
@ -1814,6 +1815,10 @@ openerp.mail = function (session) {
if (!this.ParentViewManager.is_action_enabled('edit')) {
this.node.params.show_link = false;
}
this.dataset = new session.web.DataSet(this,"ir.actions.client");
this.dataset.call('check_message_security', [this.session.uid]).then(function(result){
self.node.params.display_log_button = result;
});
},
start: function () {

View File

@ -51,8 +51,10 @@
<div class="field_text oe_compact oe_compact_record">
<a class="oe_compose_post" t-if="widget.options.compose_placeholder"><t t-raw="widget.options.compose_placeholder"/></a>
<a class="oe_compose_post" t-if="!widget.options.compose_placeholder and !widget.options.view_mailbox">Send a message</a>
<span class="oe_grey oe_sep_word">or</span>
<a class="oe_compose_log">Log a note</a>
<t t-if="widget.options.display_log_button">
<span class="oe_grey oe_sep_word">or</span>
<a class="oe_compose_log">Log a note</a>
</t>
</div>
</t>
</div>