[ADD]: add an option in chatter 'display_log_button', that is true for employee actio...
authorajay javiya (OpenERP) <aja@tinyerp.com>
Fri, 20 Sep 2013 13:04:49 +0000 (18:34 +0530)
committerajay javiya (OpenERP) <aja@tinyerp.com>
Fri, 20 Sep 2013 13:04:49 +0000 (18:34 +0530)
bzr revid: aja@tinyerp.com-20130920130449-8c5z33tgegftdxu3

addons/mail/mail_message.py
addons/mail/static/src/js/mail.js
addons/mail/static/src/xml/mail.xml

index 72ccdc8..6ed6b14 100644 (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
index 35a6adf..5cc195c 100644 (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 () {
index e6c84ea..182346c 100644 (file)
                 <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>