1

I am facing a problem this.get_critical_paths(events).done is not a function

When I tried debugging the problem I can see the console.log(paths)

Then I got this

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

I am not sure what to do to fix the problem. This is the code that should return the 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

I am trying to upgrade 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));
            }

Kindly give suggestions to improve the question instead to dismissing it

Moaz Mabrok
  • 697
  • 10
  • 32

1 Answers1

1

I tried installing the the module and dependence the error was related to the .done so i change it .then and it started working try it

change

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

            }


to

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

            }


not sure what will be the over all effect and new in odoo and js

Nrome
  • 131
  • 4