0

I am adding profiler on my custom method on Odoo v15.0 I have referred below doc for code profiling https://www.odoo.com/documentation/15.0/developer/howtos/profilecode.html

Below is the syntax i am using

from odoo.tools.profiler import profile
@profile
@api.model
def mymethod(...):
  My code

But on execution of code i am getting below error on terminal "ImportError: cannot import name 'profile' from 'odoo.tools.profiler'"

To debug the issue i have deep dived in base code of "/odoo/tool/profiler.py". But unable to locate any wrapper or function called profiler.

What is correct way to use profiling using "Log a method" strategy on odoo v15.0?

shashank verma
  • 303
  • 1
  • 3
  • 9

1 Answers1

0

Goto path and make sure you have this file for line-by-line code profiling looks like you don't have this file

From the front end in debug mode open enable profiling, this will give you all the information per user

Odoo 15 Profiling

Muhammad Yusuf
  • 563
  • 4
  • 20
  • I have the profiler.py file in odoo/tool directory but i still get error "ImportError: cannot import name 'profile' from 'odoo.tools.profiler'" – shashank verma Jul 15 '22 at 06:51
  • okay, then check your addons paths if they are configured correctly, try to import another file from tools. If nothing works, check permission, try to add tools specifically in the addons path that will give a better error if there is still no error then I give up – Muhammad Yusuf Jul 15 '22 at 10:52