mdemo = True
for dep in module.dependencies_id:
if dep.state == 'unknown':
- raise orm.except_orm(_('Error'), _('Unmet dependency: %s') % (dep.name,))
+ raise orm.except_orm(_('Error'), _('You try to install a module that depends on the module: %s.\nBut this module is not available in your system.') % (dep.name,))
if dep.state != newstate:
ids2 = self.search(cr, uid, [('name','=',dep.name)])
mdemo = self.state_update(cr, uid, ids2, newstate, states_to_update, context, level-1,) and mdemo
match = re.search('-([a-zA-Z0-9\._-]+)(\.zip)', mod.url, re.I)
version = '0'
if match:
- version = match.group(1)
+ version = match.group(1)
if vercmp(mod.installed_version or '0', version) >= 0:
continue
res.append(mod.url)
if not download:
continue
zipfile = urllib.urlopen(mod.url).read()
- fname = addons.get_module_path(mod.name+'.zip')
+ fname = addons.get_module_path(mod.name+'.zip')
try:
fp = file(fname, 'wb')
fp.write(zipfile)
p_id = c_id
categs = categs[1:]
self.write(cr, uid, [id], {'category_id': p_id})
+
+ def action_install(self,cr,uid,ids,context=None):
+ self.write(cr , uid, ids ,{'state' : 'to install'})
+ self.download(cr, uid, ids, context=context)
+ for id in ids:
+ cr.execute("select m.id as id from ir_module_module_dependency d inner join ir_module_module m on (m.name=d.name) where d.module_id=%d and m.state='uninstalled'",(id,))
+ dep_ids = map(lambda x:x[0],cr.fetchall())
+ if len(dep_ids):
+ self.action_install(cr,uid,dep_ids,context=context)
module()
class module_dependency(osv.osv):
'note':fields.text('Text'),
'action_id':fields.many2one('ir.actions.act_window', 'Action', select=True,required=True, ondelete='cascade'),
'sequence':fields.integer('Sequence'),
- 'state':fields.selection([('open', 'Open'),('done', 'Done'),('skip','Skip')], string='State', required=True)
+ 'state':fields.selection([('open', 'Not Started'),('done', 'Done'),('skip','Skipped')], string='State', required=True)
}
_defaults={
'state': lambda *a: 'open',