Hello All,
I am trying to change an element from a list of elements, but the correct syntax to access and modify that element internally using a typical controller is not yet available..
Code:
----------- ->
{
"jsonrpc": "2.0",
"id": null,
"result":
{
"code": 200,
"message": "Done",
"result": [
{
"name": "22",
"active_app": true,
"start_date": "2022-07-04 16:41:09",
"end_date": false,
"url2": false,
"zipcode": false,
"country_ids": [
{
"id": 233,
"name": "United States",
"first name": [ 1, "John" ],
- "last_name": [ 1, "Mark" ],
"code": "US",
"address_format": "%(street)s\n%(street2)s\n",
"address_view_id": false,
"currency_id": [ 2, "USD" ],
"image_url": "/base/static/img/us.png",
"phone_code": 1, "country_group_ids": [],
"name_position": "before",
"vat_label": "EIN",
"state_required": true,
"zip_required": true,
"__last_update": "2022-01-12 01:02:51",
"display_name": "United States",
"create_uid": [ 1, "Bot" ],
"create_date": "2022-01-12 01:02:51",
"write_uid": [ 1, "Bot" ],
"write_date": "2022-01-12 01:02:51"
}
],
"partner_id": "res.partner()",
"selected_page": "Sale",
"image": false
},
{
"active_app": true,
"start_date": "2022-08-09 13:56:15",
"end_date": false,
"url2": false,
"zipcode": false
}
]
}
}
----------------------
-> res_country.write({'country_ids''last_name': kwargs['name']})
I found this line to be ineffective.
I desire to alter the first and last name field with write method.
Help me please.
if your res.country model has first_name and last_name fieds available then you can update recordset with following ways
i assume that res_country is recordset
res_country.write({'last_name': kwargs['name'],'first_name': kwargs['name']})
or
res_country.last_name = kwargs['name']
res_country.first_name = kwargs['name']