How it works...

The method starts by checking whether the book recordset that's passed as self contains exactly one record by calling ensure_one(). This method will raise an exception if this is not the case, and the processing will abort. This is needed, because we don't want to change the date of multiple records. If you want to update multiple values, you can remove ensure_one() and update the attribute using a loop on the recordset.

Finally, the method modifies the values of the attributes of the book record. It updates the date_updated field by the current time. Just by modifying the field attributes of the recordset, you can perform write operations.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset