Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
6288 Widoki

I try to invoke a json-rpc api call in Postman, everything works well, but I dont know how to pass the pagination params (offset, limit):
I try this raw JSON:

----------------------------------------------------
{
"jsonrpc": "2.0",
"method": "call",
"params": {
"service": "object",
"method": "execute",
"args": [
  "user",
  2,
  "token",
  "stock.move",
  "search_read",
  [
    ["product_id", "in", [3642]],
    ["state", "not in", ["draft", "cancel"]]
  ],
  {"limit": 1}     

 ]
},
"id": 1
}
----------------------------------------------------
but get the error:
"Invalid field 'limit' on model 'stock.move'"
The question is: How to pass offset and limit params in raw JSON query?

Awatar
Odrzuć
Autor Najlepsza odpowiedź

  Two years have passed 
  This doesn't work: {"limit": 10, "offset": 0}
  I`ve already found out a working solution 2y ago:

----------- --------------------------------------- --
{
"jsonrpc": "2.0",
"method": "call",
"params": {
"service": "object",
"method": "execute",
"args": [
  "user",
  2 ,
  "token",
  "stock.move",
  "search_read",
  [
    ["product_id", "in", [3642]],
    ["state", "not in", ["draft", "cancel"]]
  ],
  [], -- Here go fields of object to retrieve

  0, 100 --  And here are two separate params offset & limit

 ]
},
"id": 1
}
----------------------------------------- -----------





Awatar
Odrzuć
Najlepsza odpowiedź
try this way:{
"jsonrpc": "2.0",
"method": "call",
"params": {
"service": "object",
"method": "execute",
"args": [
"user",
2,
"token",
"stock.move",
"search_read",
[
["product_id", "in", [3642]],
["state", "not in", ["draft", "cancel"]]
],
{},
{"limit": 10, "offset": 0}
]
},
"id": 1
}

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
mar 15
5786
0
lip 25
223
1
cze 25
1895
1
lip 25
877
1
kwi 25
1537