【问题标题】:odoo 14 Unhandled Promise done is not a functionodoo 14 Unhandled Promise done is not a function
【发布时间】:2021-07-06 02:37:58
【问题描述】:

我遇到了问题this.get_critical_paths(events).done is not a function

当我尝试调试问题时,我可以看到 console.log(paths)

然后我得到了这个

Unhandled Promise Rejection: ReferenceError: Can't find variable: paths

我不确定如何解决该问题。 这是应该返回paths var

的代码
@api.model

def calc_critical_paths(self, project_ids):

    res = {}

    projects = self.env['project.project'].browse(project_ids)

    for project in projects:

        res.update({

            project.id: self.calc_critical_path(project)

        })

    return res

我正在尝试升级The project timeline critical path

            if (this.modelName === 'project.task') {
                this.get_critical_paths(events).done(function(paths) {
                    this.critical_paths = paths;
                    this.draw_canvas();
                }.bind(this));
            }

请提出改进​​问题的建议,而不是忽略它

【问题讨论】:

    标签: javascript python odoo odoo-11 odoo-14


    【解决方案1】:

    我尝试安装模块并依赖错误是 与.done 相关,所以我将其更改为.then 并开始工作尝试

    改变

    if (this.modelName === 'project.task') {
                   
                    this.get_critical_paths(events).done(function(paths) {
                        this.critical_paths = paths;
                        this.draw_canvas();
                    }.bind(this));
    
                }
    
    
    

    if (this.modelName === 'project.task') {
                   
                    this.get_critical_paths(events).then(function(paths) {
                        this.critical_paths = paths;
                        this.draw_canvas();
                    }.bind(this));
    
                }
    
    
    

    不确定 odoo 和 js 的总体效果和新功能是什么

    【讨论】:

    • 它有效,然后在其他 odoo js 中播种,但不知道有什么区别。谢谢你的帮助
    猜你喜欢
    • 2019-02-24
    • 1970-01-01
    • 1970-01-01
    • 2017-04-13
    • 1970-01-01
    • 2020-03-17
    • 2020-01-06
    • 2021-03-10
    • 2021-09-30
    相关资源
    最近更新 更多