简体   繁体   English

如何在odoo 11上使用openerp 7.0的以下javascript语句?

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

In the following piece of code , I am getting error on line no 2 . 在下面的代码中,第2行出现错误。 I want to convert line no 2 as per new syntax suitable for odoo 11. Please help in this. 我想按照适合odoo 11的新语法转换第2行。请提供帮助。

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();
            }
)};

That widget will be failing even on OpenERP 7.0 because of errors with the syntax. 由于语法错误,即使在OpenERP 7.0上,该小部件也将失败。 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. 例如,您正在将属性model_iteration定义为new instance.web.Model('my_module.iteration') ,它将毫无问题地工作,但是只要您输入逗号,即表示您接下来将定义另一个属性。 Maybe you wanna define model_iteration as a function to be able to define the code like: 也许您想将model_iteration定义为一个函数,以便能够定义如下代码:

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 您将需要找到一种方法来调用函数model_iteration并且我假设将有名为displayinitBoard函数来完成代码中定义的用法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM