Anyone can explain the difference apart from the documentation.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project
- MRP
This question has been flagged
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
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up