[DOC] api: warn about onchange pitfalls
closes odoo/odoo#37836 X-original-commit: a8454381ad2151136ee2a49665f69a12b8dc7daf Signed-off-by: Adrian Torres (adt) <adt@odoo.com>
This commit is contained in:
+10
@@ -177,6 +177,16 @@ def onchange(*args):
|
||||
If the type is set to notification, the warning will be displayed in a notification.
|
||||
Otherwise it will be displayed in a dialog as default.
|
||||
|
||||
.. danger::
|
||||
|
||||
Since ``@onchange`` returns a recordset of pseudo-records,
|
||||
calling any one of the CRUD methods
|
||||
(:meth:`create`, :meth:`read`, :meth:`write`, :meth:`unlink`)
|
||||
on the aforementioned recordset is undefined behaviour,
|
||||
as they potentially do not exist in the database yet.
|
||||
|
||||
Instead, simply set the record's field like shown in the example
|
||||
above or call the :meth:`update` method.
|
||||
|
||||
.. warning::
|
||||
|
||||
|
||||
Reference in New Issue
Block a user