跳至内容
菜单
此问题已终结
1 回复
355 查看

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

形象
丢弃
相关帖文 回复 查看 活动
0
1月 21
3096
0
2月 25
882
2
12月 24
1336
1
2月 22
3425
1
2月 22
6123