This question has been flagged
3 Replies
14006 Views

Hi, i work with odoo 13. I trying get all the rows, from my table. What should I pass in my arg, for get all the string at once?


My code:

 var res = rpc.query({
            model: 'my model',
            method: 'read',
            args: [????]
        }).then(function (data) {
            console.log(data); });
        };
Avatar
Discard
Best Answer

the arg is empty wtih [] if the function has no params , if has params [value1,value2]

Avatar
Discard
Best Answer

Hi,

You can use the below code to achieve it:

var domain = [];
var fields = [];
rpc.query({
model: my_model,
method: 'search_read',
args: [domain, fields],
}).then(function (data) {
console.log(data);
});

Regards

Avatar
Discard
Best Answer

This is a duplicated question

See my answer at your other question at: https://www.odoo.com/es_ES/forum/ayuda-1/question/how-to-use-rpc-query-in-javascript-with-read-method-for-get-all-rows-from-table-173529


Avatar
Discard