How can I use following javascript statement of openerp 7.0 to odoo 11?

100 Views Asked by At

In the following piece of code , I am getting error on line no 2 . I want to convert line no 2 as per new syntax suitable for odoo 11. Please help in this.

var ShowTaskBoard = Widget.extend({
model_iteration: new instance.web.Model('my_module.iteration'),

self.model_iteration.query() 
            .filter([["is_active","=","true"]])
            .order_by("project_id")
            .all().done(function (records) {
                _(records).each(display);

                // create board for first entry
                self.initBoard();
            }
)};
1

There are 1 best solutions below

0
aekis.dev On

That widget will be failing even on OpenERP 7.0 because of errors with the syntax. Maybe will be better if you provide the original code. For example you are defining the property model_iteration as new instance.web.Model('my_module.iteration') which will work without issues but as long a you put a comma you are saying that next you will be defining another property. Maybe you wanna define model_iteration as a function to be able to define the code like:

var ShowTaskBoard = Widget.extend({
    model_iteration: function() {
        var self = this;
        new instance.web.Model('my_module.iteration').query() 
            .filter([["is_active","=","true"]])
            .order_by("project_id")
            .all().done(function (records) {
                _(records).each(display);
                // create board for first entry
                self.initBoard();
            }
    }
)};

You will need to find a way to call the function model_iteration and I assume that there will be functions named display and initBoard to complete the usage defined in your code