Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
1 Responder
248 Visualizações

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

            ]

        ]

    }

}


Avatar
Cancelar
Melhor resposta

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

Avatar
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
0
jan. 21
3002
0
fev. 25
738
2
dez. 24
1177
1
fev. 22
3326
1
fev. 22
5961