Wednesday, July 26, 2017
1 change · master
Enhancements to existing features
This change adds a profiling tool that helps developers measure how long Odoo operations take and how many database queries they use. It can be focused on specific models or files, making it easier to find performance bottlenecks before they affect users.
Original PR description
Add the decorator ´odooProfile´ on the method that serves as the entry point. By default all the methods of all the models are logged. Options: * whitelist: None or list of model names to display in…
Add the decorator ´odooProfile´ on the method that serves as the entry
point. By default all the methods of all the models are logged.
Options:
* whitelist: None or list of model names to display in the log
(Default: None)
* files: None or list of filenames to display in the log
(Default: None)
* blacklist: None or list model names to remove from the log
(Default: remove non odoo model from the log: [None])
* minimum_time: minimum time (ms) to display a method
(Default: 0)
* minimum_queries: minimum sql queries to display a method
(Default: 0)
* shallow: Boolean to log only the first level
(Default: False)
´
from odoo.tools.profiler import odooProfile
class SaleOrder(models.Model):
...
@api.model
@odooProfile
def create(self, vals):
...
@odooProfile(whitelist=['sale.order', 'ir.model.data'])
def action_quotation_send(self):
...
@odooProfile(files=['/home/openerp/odoo/odoo/addons/sale/models/sale.py'])
def write(self):
...
´
NB: The use of the profiler modifies the execution time (the more the log is
complete minus the time)
Description of the issue/feature this PR addresses:
Current behavior before PR:
Desired behavior after PR is merged:
--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr