function customer_counter (widget) { "use strict"; widget.CustomerCounterWidget = widget.Base.extend({ template: 'CustomerCounterTmpl', events: { 'click a': 'showCustomers' }, customers: [], fields: ['name'], domain: [['customer', '=', true], ['active', '=', true]], init: function (parent) { this._super(parent, { width: 3, height: 2 }); }, start: function () { var self = this; this.getCustomers().then(function (customers) { self.customers = customers; self.renderWidget(); }); }, getCustomers: function () { var Customer = new instance.web.Model('res.partner'); return Customer.query(this.fields).filter(this.domain).order_by(['id']).all(); }, renderWidget: function () { console.log(this.customers); }, showCustomers: function (e) { this.do_action({ type: 'ir.actions.act_window', res_model: "res.partner", views: [[false, 'list']], target: 'new', domain: [['customer', '=', true]], context: {}, }); } }); }