Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
Seriously I can't find the decent point to say both are different to each other. and give me one example to which saturation to use @api.one and @api.multi ?
One more thinks i would like to ask even if I define a method, that case which one is either @api.one or @api.multi preferable to specify above the method. thank you
If I am not mistaking it is very easy and clear.
The @api.one is specific for one record and can not be used for multiple records. It automaticly loops on records of of a Recordset for you.
@api.many is for multiple records, where you can loop through it etc. It will be the current Recordset without the itiration. So any looping would need to be programmed by yourself, for whatever you want
An example of @api.one:
@api.one def _compute_name(self):
self.name = str(random.randint(1, 1e6))
An example of @api.multi:
@api.multi def subscribe(self):
for session in self.session_ids:
session.attendee_ids |= self.attendee_ids
You can read more about the @api.one and @api.multi here: http://odoo-new-api-guide-line.readthedocs.org/en/latest/decorator.html
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 11/19/14, 12:12 AM|
|Seen: 14673 times|
|Last updated: 7/1/16, 6:50 AM|