diff --git a/bin/addons/base/module/module.py b/bin/addons/base/module/module.py index fdd8af2d488..ceb454d40fa 100644 --- a/bin/addons/base/module/module.py +++ b/bin/addons/base/module/module.py @@ -461,14 +461,14 @@ class module(osv.osv): 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) @@ -516,6 +516,15 @@ class module(osv.osv): 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): diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 2982b5ad4d0..50c373c4f6e 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -1119,9 +1119,11 @@ class orm_memory(orm_template): for id in ids: r = {'id': id} for f in fields: - r[f] = self.datas[id].get(f, False) + if id in self.datas: + r[f] = self.datas[id].get(f, False) result.append(r) - self.datas[id]['internal.date_access'] = time.time() + if id in self.datas: + self.datas[id]['internal.date_access'] = time.time() fields_post = filter(lambda x: x in self._columns and not getattr(self._columns[x], load), fields) for f in fields_post: res2 = self._columns[f].get_memory(cr, self, ids, f, user, context=context, values=False)