Amit Dodiya (OpenERP) has proposed merging
lp:~openerp-dev/openobject-server/6.0-opw-381612-ado into
lp:openobject-server/6.0.
Requested reviews:
Naresh(OpenERP) (nch-openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-server/6.0-opw-381612-ado/+merge/88682
Hello,
[FIX] Dependencies loop executes when you install a new module
When you install any new module, the dependencies loop is executes and check
all the dependencies of all the dependant modules.
So when we have big dependencies tree, it will take lot of time to finish the
installation.
Thanks,
Amit
--
https://code.launchpad.net/~openerp-dev/openobject-server/6.0-opw-381612-ado/+merge/88682
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-server/6.0-opw-381612-ado.
=== modified file 'bin/addons/base/module/module.py'
--- bin/addons/base/module/module.py 2011-01-13 09:41:00 +0000
+++ bin/addons/base/module/module.py 2012-01-16 13:21:42 +0000
@@ -261,21 +261,23 @@
msg = _('Unable to process module "%s" because an external dependency is not met: %s')
raise orm.except_orm(_('Error'), msg % (module_name, e.args[0]))
- def state_update(self, cr, uid, ids, newstate, states_to_update, context=None, level=100):
+ def state_update(self, cr, uid, ids, newstate, states_to_update, context=None, level=100, res=[]):
if level<1:
raise orm.except_orm(_('Error'), _('Recursion error in modules dependencies !'))
demo = False
for module in self.browse(cr, uid, ids):
mdemo = False
for dep in module.dependencies_id:
- if dep.state == 'unknown':
- raise orm.except_orm(_('Error'), _("You try to install module '%s' that depends on module '%s'.\nBut the latter module is not available in your system.") % (module.name, dep.name,))
- ids2 = self.search(cr, uid, [('name','=',dep.name)])
- if dep.state != newstate:
- mdemo = self.state_update(cr, uid, ids2, newstate, states_to_update, context, level-1,) or mdemo
- else:
- od = self.browse(cr, uid, ids2)[0]
- mdemo = od.demo or mdemo
+ if dep.name not in res:
+ res.append(dep.name)
+ if dep.state == 'unknown':
+ raise orm.except_orm(_('Error'), _("You try to install module '%s' that depends on module '%s'.\nBut the latter module is not available in your system.") % (module.name, dep.name,))
+ ids2 = self.search(cr, uid, [('name','=',dep.name)])
+ if dep.state != newstate:
+ mdemo = self.state_update(cr, uid, ids2, newstate, states_to_update, context, level-1, res=res) or mdemo
+ else:
+ od = self.browse(cr, uid, ids2)[0]
+ mdemo = od.demo or mdemo
self.check_external_dependencies(module.name, newstate)
if not module.dependencies_id:
@@ -286,7 +288,8 @@
return demo
def button_install(self, cr, uid, ids, context=None):
- return self.state_update(cr, uid, ids, 'to install', ['uninstalled'], context)
+ res = []
+ return self.state_update(cr, uid, ids, 'to install', ['uninstalled'], context, res=res)
def button_install_cancel(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state': 'uninstalled', 'demo':False})
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp