title: How to override js functions in odoo 8?
body: <p>want to customize IM chat button in odoo 8. i want to make it invisible for others except one group so i have inherited js file into my module. original file is im_chat.js file.</p>
  
  <pre><code>if(openerp.web &amp;&amp; openerp.web.UserMenu) {
      openerp.web.UserMenu.include({
          do_update: function(){
              var self = this;
              var Users = new openerp.web.Model('res.users');
              Users.call('has_group', ['bms.group_custom_chats']).done(function(is_employee) {
                  if (is_employee) {
                      self.update_promise.then(function() {
                          var im = new openerp.im_chat.InstantMessaging(self);
                          openerp.im_chat.single = im;
                          im.appendTo(openerp.client.$el);
                          var button = new openerp.im_chat.ImTopButton(this);
                          button.on("clicked", im, im.switch_display);
                          // button.appendTo(window.$('.oe_systray'));
                      });
                  }
              });
              return this._super.apply(this, arguments);
          },
      });
  }
  </code></pre>
  
  <p>here i have inserted 'bms.group' instead of 'base.group_user'. the purpose of this function is it will hide chat button to users other than in that group. if i add that line into base file its working well, but the thing is its not working in this case.</p>
  
  <p><code>this is how is how I override the base js script</code>
  I have saved im_chat.js file into my srcopenerp.py file.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;openerp&gt;
  &lt;data&gt;
      &lt;template id="custom_unique_id" name="some name to template" inherit_id="web.assets_backend"&gt;
          &lt;xpath expr="." position="inside"&gt;
              &lt;script type="text/javascript" src="/bms/static/src/js/im_chat.js"&gt;&lt;/script&gt;
          &lt;/xpath&gt;
      &lt;/template&gt;
  &lt;/data&gt;
  </code></pre>
  
  <p></p>
  
  <p>This is python code for checking users of a group.</p>
  
  <pre><code>@tools.ormcache(skiparg=2)
  def has_group(self, cr, uid, group_ext_id):
      """Checks whether user belongs to given group.
  
      :param str group_ext_id: external ID (XML ID) of the group.
         Must be provided in fully-qualified form (``module.ext_id``), as there
         is no implicit module to use..
      :return: True if the current user is a member of the group with the
         given external ID (XML ID), else False.
      """
      assert group_ext_id and '.' in group_ext_id, "External ID must be fully qualified"
      module, ext_id = group_ext_id.split('.')
      cr.execute("""SELECT 1 FROM res_groups_users_rel WHERE uid=%s AND gid IN
                      (SELECT res_id FROM ir_model_data WHERE module=%s AND name=%s)""",
                 (uid, module, ext_id))
      return bool(cr.fetchone())
  </code></pre>
  
  <p>Please help me.</p>
  
  <p>Thank you</p>