There's more...

When using mapped(), keep in mind that it operates in memory inside the Odoo server by repeatedly traversing relations and therefore making SQL queries, which may not be efficient. However, the code is terse and expressive. If you are trying to optimize a method on the critical path of the performance of your instance, you may want to rewrite the call to mapped() and express it as a search() with the appropriate domain, or even move to SQL (at the cost of readability).

The mapped() method can also be called with a function as an argument. In this case, it returns a list containing the result of the function that's applied to each record of self, or the union of the recordsets that's returned by the function, if the function returns a recordset.

..................Content has been hidden....................

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