Skip to Content
Menu
This question has been flagged
1 Reply
3882 Views

Anyone can explain the difference apart from the documentation.

Avatar
Discard
Best Answer

Hi,

@api.returns is the decorator,specifying what needs to be return, either id, ids, False or recordset.
For example, the generally create method returns the record set of newly created records for a particular model. Now for that specific model, if you want to return a dictionary instead of that record set, then you can define @api.returns. In otherway write method returns the Boolean value ( True or False ). That returned value becomes useless sometimes. So with usage of @api.returns you can return the Recordset / List of ids which are successfully updated.

@api.model also a decorator is used with the methods where self is a record set, but only the model is relevant and not its contents. It helps in the code migration since it will convert the old API calls to the new ones, which makes the migration process faster.

Regards

Avatar
Discard