Skip to Content
Menu
This question has been flagged
1 Reply
3186 Views

Hello fellows, how you doing?

I build my custom template for invoice analysis and it's being displayed twice. The first one empty once any search was did and the second when it returns a search result... May could some one help me?


start: function() {
        var sup = this._super();
        var self = this;
        self.render();
    },
    /*render template passing no values*/
    render: function(){
        var self = this;
        var invoices = Invoices.call('dashboard_invoceis_action_id', []).then(function(result){
            self.$el.append(QWeb.render('InvoiceTemplate', {invoices: result}));
        });
    },
    do_search: function(event) {
        var self = this;
        if(event.which == 13) {
            var search_term = $(event.currentTarget).val();
            var invoice_id = $(event.currentTarget).data('export-id');
            var invoices = Invoices.call('do_search', [{'search_term':search_term}]).then(function(result){
                self.$el.append(QWeb.render('InvoiceTemplate', {invoices: result}));
            });
        }
    },

Avatar
Discard
Best Answer

Hi,


            self.$el.append(QWeb.render('InvoiceTemplate', {invoices: result}));

this  appends in two functions in render(), do_search try to set in one method.


regards,

Silvestar


  

Avatar
Discard
Author

Thank you Silverstar

Related Posts Replies Views Activity
0
Mar 23
1400
0
Mar 24
4505
2
Sep 17
6065
0
Oct 24
120
1
Aug 24
251