@@ -770,14 +770,55 @@ pass the returned IDs to the [``list``](#list) method.
770770| -------------| --------------------------------------|
771771| ` list[int] ` | The IDs of the newly created records |
772772
773+ ### ` update `
774+
775+ ``` python
776+ def update (record : int | Record, ** fields : Any) -> None
777+ ```
778+
779+ Update one or more fields on this record in place.
780+
781+ ```python
782+ >> > from openstack_odooclient import Client as OdooClient
783+ >> > odoo_client = OdooClient(
784+ ... hostname = " localhost" ,
785+ ... port = 8069 ,
786+ ... protocol = " jsonrpc" ,
787+ ... database = " odoodb" ,
788+ ... user = " test-user" ,
789+ ... password = " <password>" ,
790+ ... )
791+ >> > odoo_client.users.get(1234 )
792+ User(record = {' id' : 1234 , ' name' : ' Old Name' , ... }, fields = None )
793+ >> > odoo_client.users.update(1234 , name = " New Name" )
794+ >> > odoo_client.users.get(1234 )
795+ User(record = {' id' : 1234 , ' name' : ' New Name' , ... }, fields = None )
796+ ```
797+
798+ Field names are passed as keyword arguments.
799+ This method has the same flexibility with regards to what
800+ field names are used as when [creating records](# create);
801+ for example, when updating a model ref, either its ID
802+ (e.g. `` user_id`` ) or object (e.g. `` user`` ) field names
803+ can be used.
804+
805+ * Added in version 0.2 .0.*
806+
807+ # ### Parameters
808+
809+ | Name | Type | Description | Default |
810+ | ------------ | ---------------- | ---------------------------------------- - | ------------ |
811+ | `record` | `int | Record` | The record to update (object or ID ) | (required) |
812+ | `** fields` | `Any` | Record field values (keyword arguments) | (required) |
813+
773814# ## `unlink`/`delete`
774815
775816```python
776- unlink(* records: Record | int | Iterable[Record | int ]) -> None
817+ unlink(* records: int | Record | Iterable[int | Record ]) -> None
777818```
778819
779820```python
780- delete(* records: Record | int | Iterable[Record | int ]) -> None
821+ delete(* records: int | Record | Iterable[int | Record ]) -> None
781822```
782823
783824Delete one or more records from Odoo.
@@ -1357,6 +1398,44 @@ User(record={'id': 1234, ...}, fields=None)
13571398| ------------------ | ------------------ - |
13581399| `dict[str , Any]` | Record dictionary |
13591400
1401+ # ### `update`
1402+
1403+ ```python
1404+ def update(** fields: Any) -> None
1405+ ```
1406+
1407+ Update one or more fields on this record in place.
1408+
1409+ ```python
1410+ >> > user
1411+ User(record = {' id' : 1234 , ' name' : ' Old Name' , ... }, fields = None )
1412+ >> > user.update(name = " New Name" )
1413+ >> > user.refresh()
1414+ User(record = {' id' : 1234 , ' name' : ' New Name' , ... }, fields = None )
1415+ ```
1416+
1417+ Field names are passed as keyword arguments.
1418+ This method has the same flexibility with regards to what
1419+ field names are used as when [creating records](# create);
1420+ for example, when updating a model ref, either its ID
1421+ (e.g. `` user_id`` ) or object (e.g. `` user`` ) field names
1422+ can be used.
1423+
1424+ !!! note
1425+
1426+ This record object is not updated in place by this method.
1427+
1428+ If you need an updated version of the record object ,
1429+ use the [`refresh` ](# refresh) method to fetch the latest version.
1430+
1431+ * Added in version 0.2 .0.*
1432+
1433+ # #### Parameters
1434+
1435+ | Name | Type | Description | Default |
1436+ | ------------ | ------ - | ---------------------------------------- - | ------------ |
1437+ | `** fields` | `Any` | Record field values (keyword arguments) | (required) |
1438+
13601439# ### `refresh`
13611440
13621441```python
@@ -1395,9 +1474,10 @@ Delete this record from Odoo.
13951474
13961475```python
13971476>> > user
1398- User(record = {' id' : 1234 , ' name ' : ' Old Name ' , ... }, fields = None )
1477+ User(record = {' id' : 1234 , ... }, fields = None )
13991478>> > user.unlink()
14001479>> > user.refresh()
1480+ Traceback (most recent call last):
14011481...
14021482openstack_odooclient.exceptions.RecordNotFoundError: User record not found with ID : 1234
14031483```
0 commit comments