res[0] += 1
return res
- def download(self, cr, uid, ids, context=None):
+ def download(self, cr, uid, ids, download=True, context=None):
+ res = []
adp = tools.config['addons_path']
for mod in self.browse(cr, uid, ids, context=context):
if not mod.url:
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 = os.path.join(adp, mod.name+'.zip')
try:
except IOError, e:
raise orm.except_orm('Error', 'Can not create the module file:\n %s'
% (fname,))
+ return res
def _update_dependencies(self, cr, uid, id, depends=[]):
for d in depends:
<field name="model">ir.module.module</field>
<field name="type">tree</field>
<field name="arch" type="xml">
- <tree string="Module list" colors="blue:state=='to upgrade' or state=='to install';grey:state=='uninstalled' or state=='uninstallable'">
+ <tree string="Modules" colors="blue:state=='to upgrade' or state=='to install';grey:state=='uninstalled' or state=='uninstallable'">
<field name="name"/>
<field name="shortdesc"/>
<field name="author"/>
<label align="0.0" string="Note that this operation my take a few minutes." colspan="4"/>
<separator string="Modules to update"/>
<field name="module_info" nolabel="1" colspan="4"/>
+ <separator string="Modules to download"/>
+ <field name="module_download" nolabel="1" colspan="4"/>
</group>
</form>"""
view_field = {
- "module_info": {'type':'text', 'string':'Modules', 'readonly':True}
+ "module_info": {'type': 'text', 'string': 'Modules to update',
+ 'readonly': True},
+ "module_download": {'type': 'text', 'string': 'Modules to download',
+ 'readonly': True},
}
class wizard_info_get(wizard.interface):
mod_obj = pool.get('ir.module.module')
ids = mod_obj.search(cr, uid, [
('state', 'in', ['to upgrade', 'to remove', 'to install'])])
- res = pool.get('ir.module.module').read(cr, uid, ids, ['name','state'], context)
- return {'module_info':'\n'.join(map(lambda x: x['name']+' : '+x['state'], res))}
+ res = mod_obj.read(cr, uid, ids, ['name','state'], context)
+ url = mod_obj.download(cr, uid, ids, download=False, context=context)
+ return {'module_info': '\n'.join(map(lambda x: x['name']+' : '+x['state'], res)),
+ 'module_download': '\n'.join(url)}
def _upgrade_module(self, cr, uid, data, context):
pool=pooler.get_pool(cr.dbname)