Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Calling Odoo models in call() and query() method

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 524
    Comment on it

    call() and query() method are the odoo methods which are used in def function in .py file, it is used to call the value.

    To call the Odoo server objects we use two primary methods which are call() and query(), for this see the code example below and if you need it then use it in your .py file/p>

    var Users = new Model('res.users');
    
    Users.call('change_password', ['oldpassword', 'newpassword'],
                      {context: some_context}).then(function (result) {
        // do something with change_password result
    });
    Users.query(['name', 'login', 'user_email', 'signature'])
         .filter([['active', '=', true], ['company_id', '=', main_company]])
         .limit(15)
         .all().then(function (users) {
        // do work with users records
    });
    

    Note-Its usage is similar to that of the Odoo Model API,

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: