Sometimes, you are unable to pinpoint the cause of an issue. This is especially true for performance issues. Odoo provides some built-in profiling tools that help you find the real cause of an issue.
Profiling Python code
How to do it...
Odoo's profiler is available at odoo/tools/profiler.py. In order to use the profiler in your code, import it into the file:
from odoo.tools.profiler import profile
After importing it, you can use the profile decorator on the methods. To profile a particular method, you need to add the profile decorator on it. Take a look at the following example. We put the profile decorator on the make_available method:
@profile
def make_available(self):
if self.state != 'lost&apos...