Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
263 Переглядів

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}]

            ]

        ]

    }

}


Аватар
Відмінити
Найкраща відповідь

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

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
0
січ. 21
3005
0
лют. 25
767
2
груд. 24
1193
1
лют. 22
3335
1
лют. 22
5975