Dario
Dario

Reputation: 767

Odoo 10.0 frontend query the db for storing data

In Odoo 11.0 i use this method for storing data or making query to db:

rpc.query({
    model: "sale.order.checklist.line",
    method: "write",
    args: [checklist_line_id_int, {
        answer_yes: value
    }],
}).then(setTimeout(function() {
    //Set a delay or the update is not visible
    window.location.reload(true);
}, 300));

How can i do the same in Odoo 10.0? I need to update the value changed from user and with ajax update the single div that contain data

Upvotes: 1

Views: 161

Answers (1)

Dario
Dario

Reputation: 767

Founded the solution

 //call method that write the new value for checkbox
 var Checklists = new Model('sale.order.checklist.line');
 Checklists.call('write', [checklist_line_id_int, {answer_yes: checkboxValue}]
     ).then(function () {
           window.location.reload();
 });

This code make a write of boolean value. Anyway it's possible to call a method inside model, instead of writing 'write', just call the name of method declared inside model and as key{} pass the required parameters in case you need to pass them.

Upvotes: 1

Related Questions