Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
359 Vistas

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
Descartar
Mejor respuesta

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
0
ene 21
3096
0
feb 25
885
2
dic 24
1342
1
feb 22
3427
1
feb 22
6130