Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
16206 Lượt xem

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); });
        };
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 6 18
3356
1
thg 6 18
3964
0
thg 3 15
3762
0
thg 9 23
978
1
thg 6 23
3943