~fabien-morin/unifield-web/perf_improvement_web

« back to all changes in this revision

Viewing changes to addons/openerp/controllers/modules.py

  • Committer: Fabien MORIN
  • Date: 2016-08-12 14:15:36 UTC
  • Revision ID: fabien.morin@tempo-consulting.fr-20160812141536-mhp13yxw9a2179la
US-1246 [IMP] has_new_modules seems to be called all the time (many times only
for loading a po). There is no need to check for new modules all the time
because they are already checked in load_addons() (./openobject/addons.py) on
login and restart.
Removing this code give 24 sql requests less on a po displaying but that
improvement will probably benefit to all views of unifield.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
class ModuleForm(form.Form):
15
15
    _cp_path = "/openerp/modules"
16
16
 
17
 
    def has_new_modules(self):
18
 
        """ Returns whether there are new web modules available for download
19
 
        (brand new or updates)
20
 
 
21
 
        :rtype bool:
22
 
        """
23
 
        return bool([
24
 
            name for (name, version) in rpc.RPCProxy('ir.module.module').list_web()
25
 
            if (not addons.exists(name)
26
 
                or version > addons.get_info(name).get('version', '0')
27
 
                or name not in addons._loaded[cherrypy.session.get('db')])
28
 
        ])
29
 
 
30
17
    def get_new_modules(self):
31
18
        if not addons.writeable: return []
32
19
        modules = rpc.RPCProxy('ir.module.module')