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

Greetings

I am looking for advice on bulk update via jsonrpc.

I've alredy used bulk "create" and "unlink" and, for me at least, it seams obvious that "write" should also have bulk option but i`m strugling to figure it out.

Tried some variants that are similar to create structure but nothing worked:

{

    "jsonrpc": "2.0",

    "method": "call",

    "params": {

        "service": "object",

        "method": "execute_kw",

        "args": [

            "{{db_name}}",

            {{user_id}},

            "{{api_key}}",

            "product.template",

            "write",

            [

                [3433, {"x_studio_stock_mask": 1334}], 

                [3548, {"x_studio_stock_mask": 1334}]

            ]

        ]

    }

}


Awatar
Odrzuć
Najlepsza odpowiedź

Hi,

Yes, it is possible to update multiple records using the XML-RPC API in Odoo. You can use the write method as shown in the example below:

endpoint: http://<yourdomain>/jsonrpc

{

"jsonrpc": "2.0",

"method": "call",

"id": 3,

"params": {

"service": "object",

"method": "execute_kw",

"args": [

"fresh_test", // database name

2, // uid (user ID)

"1", // password

"product.product", // model

"write", // method

[

[2, 5, 3, 6, 1], // list of record IDs to update

{ // values to write to all records

"list_price": 100.00,

"standard_price": 80.00,

"default_code": "UPDATED-CODE"

}

]

]

}

}


Hope it helps

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
sty 21
3003
0
lut 25
767
2
gru 24
1191
1
lut 22
3334
1
lut 22
5972