javascript - odoo 14 Unhandled Promise done is not a function
问题描述
我面临一个问题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
我正在尝试升级项目时间线关键路径
if (this.modelName === 'project.task') {
this.get_critical_paths(events).done(function(paths) {
this.critical_paths = paths;
this.draw_canvas();
}.bind(this));
}
请提出建议以改进问题而不是驳回它
解决方案
我尝试安装模块并且依赖错误与错误有关.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 的总体效果和新功能是什么