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
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
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
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng ký