title: Odoo: Custom button in the header of odoo tree view doesnt trigger python function
body: <p><strong>Basic info</strong>:</p>
  
  <p><em>Odoo version</em> : 10.0</p>
  
  <p><em>module name</em> : simcard</p>
  
  <p><em>model name</em> : simcard.simcard</p>
  
  <p><em>Aim</em> : to add a Sync button in header of the tree view and link it to a python function.</p>
  
  <p>My template file (template.xml) :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;templates id="template" xml:space="preserve"&gt;
  
   &lt;t t-extend="ListView.buttons"&gt;
  
      &lt;t t-jquery="button.o_list_button_add" t-operation="replace"&gt;
  
          &lt;t t-if="widget.model=='simcard.simcard'"&gt;
  
              &lt;button class="btn btn-sm btn-default sync_button" type="button" &gt;Sync&lt;/button&gt;
  
          &lt;/t&gt;
  
      &lt;/t&gt;
  
  &lt;/t&gt;
  
  &lt;/templates&gt;
  </code></pre>
  
  <p>My javascript file(tree_view_button.js): </p>
  
  <pre><code>odoo.define('simcard.tree_view_button', function (require){"use strict";
      var ListView = instance.web.ListView;
      ListView.include({
      render_buttons: function() {
  
     // GET BUTTON REFERENCE
      this._super.apply(this, arguments)
      if (this.$buttons) {
      var btn = this.$buttons.find('.sync_button')
      }
  
     // PERFORM THE ACTION
      btn.on('click', this.proxy('do_sync'))
  
     },
      do_sync: function() {
      new instance.web.Model('simcard.simcard')
      .call('my_function', [[]])
      .done(function(result) {
      alert('done')
      })
      }
      });
     }
  </code></pre>
  
  <p>My python file function(models.py) :</p>
  
  <pre><code>  def my_function(self): 
      print 'fooooooooooooooo' 
  </code></pre>
  
  <p>My view file (view.xml):</p>
  
  <pre><code>   &lt;?xml version="1.0" encoding="utf-8"?&gt;
     &lt;odoo&gt;
      &lt;data&gt;
       &lt;template id="assets_backend" name="tree view menu" 
        inherit_id="web.assets_backend"&gt;               
          &lt;xpath expr="." position="inside"&gt;                   
             &lt;script type="text/javascript" 
                 src="simcard/static/js/tree_view_button.js"&gt; 
             &lt;/script&gt;               
          &lt;/xpath&gt;           
      &lt;/template&gt; 
    &lt;/data&gt;
   &lt;/odoo&gt;
  </code></pre>
  
  <p>My manifest file :</p>
  
  <pre><code>  # -*- coding: utf-8 -*-
   {
  'name': "simcard",
  
  'summary': """
      Store them""",
  
  'description': """
      Store them""",
  
  
  # Categories can be used to filter modules in modules listing
  # Check https://github.com/odoo/odoo/blob/master/odoo/addons/base/module/module_data.xml
  # for the full list
  'category': 'Uncategorized',
  'version': '0.1',
  
  # any module necessary for this one to work correctly
  'depends': ['base'],
  
  # always loaded
  'data': [
      # 'security/ir.model.access.csv',
      'views/views.xml',
      'views/templates.xml',
  ],
  
  'qweb': ['static/xml/tree_view_button.xml'],
  
  # only loaded in demonstration mode
  'demo': [
      'demo/demo.xml',
  ],
  'installable': True,
  'auto_install': False,
  'application': True,
  }
  </code></pre>
  
  <p>Sync button appears in the tree view header but i am not able to call my function when i click on that button. Is there anything i am missing??</p>