There's more...

You may encounter the @api.one decorator while reading source code. This decorator is deprecated because its behavior can be confusing at first glance; also, knowing of @api.multi, it looks like this decorator allows the method to be called only on recordsets of size 1, but it does not. When it comes to recordset length, @api.one is similar to @api.multi, but it does a for loop on the recordset outside the method and aggregates the returned value of each iteration of the loop in a list, which is returned to the caller.

Avoid using @api.one in your code.  You may want to check out the foreach decorator defined in the oca-decorators project (https://github.com/OCA/oca-decorators), which serves a similar purpose but with clearer semantics.
..................Content has been hidden....................

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