summaryrefslogtreecommitdiff
path: root/bin/addons/base/module/wizard/base_module_upgrade.py
diff options
context:
space:
mode:
authorrpa (Open ERP) <rpa@tinyerp.com>2010-09-03 11:37:04 +0530
committerrpa (Open ERP) <rpa@tinyerp.com>2010-09-03 11:37:04 +0530
commit8828c08f417962c5595cd3d9c3f77d1c172053cf (patch)
tree568b465a1c7e17ce7e578695b39d4a3b3aed8a40 /bin/addons/base/module/wizard/base_module_upgrade.py
parentacfeaf908f0878500cfecf498c987f60e3aa1933 (diff)
[IMP]: base: When there is no module to upgrade and "Apply Scheduled Upgrades" wizard is called, it should not display form view of module list
bzr revid: rpa@tinyerp.com-20100903060704-5y1cpdx7p8zo929e
Diffstat (limited to 'bin/addons/base/module/wizard/base_module_upgrade.py')
-rw-r--r--bin/addons/base/module/wizard/base_module_upgrade.py39
1 files changed, 35 insertions, 4 deletions
diff --git a/bin/addons/base/module/wizard/base_module_upgrade.py b/bin/addons/base/module/wizard/base_module_upgrade.py
index e51fe24503f..fe85cb0422c 100644
--- a/bin/addons/base/module/wizard/base_module_upgrade.py
+++ b/bin/addons/base/module/wizard/base_module_upgrade.py
@@ -34,6 +34,40 @@ class base_module_upgrade(osv.osv_memory):
'module_info': fields.text('Modules to update',readonly=True),
}
+ def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
+ """ Changes the view dynamically
+ @param self: The object pointer.
+ @param cr: A database cursor
+ @param uid: ID of the user currently logged in
+ @param context: A standard dictionary
+ @return: New arch of view.
+ """
+ res = super(base_module_upgrade, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
+ record_id = context and context.get('active_id', False) or False
+ active_model = context.get('active_model')
+ if (not record_id) or (not active_model):
+ return res
+
+ ids = self.get_module_list(cr, uid, context=context)
+ if not ids:
+ res['arch'] = '''<form string="System update done">
+ <separator string="System update completed" colspan="4"/>
+ <label align="0.0" string="The selected modules have been updated / installed !" colspan="4"/>
+ <label align="0.0" string="We suggest to reload the menu tab to see the new menus (Ctrl+T then Ctrl+R)." colspan="4"/>
+ <separator string="" colspan="4"/>
+ <newline/>
+ <button special="cancel" string="Close" icon="gtk-cancel"/>
+ <button name="config" string="Start configuration" type="object" icon="gtk-ok"/>
+ </form>'''
+
+ return res
+
+ def get_module_list(self, cr, uid, context=None):
+ mod_obj = self.pool.get('ir.module.module')
+ ids = mod_obj.search(cr, uid, [
+ ('state', 'in', ['to upgrade', 'to remove', 'to install'])])
+ return ids
+
def default_get(self, cr, uid, fields, context=None):
"""
This function checks for precondition before wizard executes
@@ -42,12 +76,9 @@ class base_module_upgrade(osv.osv_memory):
@param uid: the current user’s ID for security checks,
@param fields: List of fields for default value
@param context: A standard dictionary for contextual values
-
"""
mod_obj = self.pool.get('ir.module.module')
- data_obj = self.pool.get('ir.model.data')
- ids = mod_obj.search(cr, uid, [
- ('state', 'in', ['to upgrade', 'to remove', 'to install'])])
+ ids = self.get_module_list(cr, uid, context=context)
res = mod_obj.read(cr, uid, ids, ['name','state'], context)
return {'module_info': '\n'.join(map(lambda x: x['name']+' : '+x['state'], res))}