base: add information on module to download when upgrade modules
bzr revid: ced-73cc0c8567285f1a1a2f4b2e86b7329d5646cbf6
This commit is contained in:
parent
b019eb7990
commit
efdf54b283
|
@ -441,7 +441,8 @@ class module(osv.osv):
|
|||
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:
|
||||
|
@ -452,6 +453,9 @@ class module(osv.osv):
|
|||
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:
|
||||
|
@ -461,6 +465,7 @@ class module(osv.osv):
|
|||
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:
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
<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"/>
|
||||
|
|
|
@ -46,11 +46,16 @@ view_form = """<?xml version="1.0"?>
|
|||
<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):
|
||||
|
@ -59,8 +64,10 @@ 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)
|
||||
|
|
Loading…
Reference in New Issue