bugfix
authorFabien Pinckaers <fp@tinyerp.com>
Wed, 17 Sep 2008 15:55:18 +0000 (17:55 +0200)
committerFabien Pinckaers <fp@tinyerp.com>
Wed, 17 Sep 2008 15:55:18 +0000 (17:55 +0200)
lp bug: https://launchpad.net/bugs/271380 fixed

bzr revid: fp@tinyerp.com-20080917155518-i0sw7bd7pav0tnj5

bin/addons/base/module/module.py
bin/addons/base/module/module_view.xml

index 7879a11..fa8ce19 100644 (file)
@@ -317,8 +317,24 @@ class module(osv.osv):
     def button_uninstall_cancel(self, cr, uid, ids, context={}):
         self.write(cr, uid, ids, {'state': 'installed'})
         return True
+
     def button_upgrade(self, cr, uid, ids, context=None):
-        return self.state_update(cr, uid, ids, 'to upgrade', ['installed'], context)
+        depobj = self.pool.get('ir.module.module.dependency')
+        todo = self.browse(cr, uid, ids, context=context)
+        i = 0
+        while i<len(todo):
+            mod = todo[i]
+            i += 1
+            if mod.state not in ('installed','to upgrade'):
+                raise orm.except_orm(_('Error'),
+                        _("Can not upgrade module '%s'. It is not installed.") % (mod.name,))
+            iids = depobj.search(cr, uid, [('name', '=', mod.name)], context=context)
+            for dep in depobj.browse(cr, uid, iids, context=context):
+                if dep.module_id.state=='installed':
+                    todo.append(dep.module_id)
+        self.write(cr,uid, map(lambda x: x.id, todo), {'state':'to upgrade'}, context=context)
+        return True
+
     def button_upgrade_cancel(self, cr, uid, ids, context={}):
         self.write(cr, uid, ids, {'state': 'installed'})
         return True
index 54c9322..8580d16 100644 (file)
             <field name="type">form</field>
             <field name="arch" type="xml">
                 <form string="Module">
-                    <notebook>
+                    <field name="name" select="1"/>
+                    <field colspan="4" name="shortdesc" select="2"/>
+                    <notebook colspan="4">
                         <page string="Module">
-                            <field name="name" select="1"/>
-                            <field colspan="4" name="shortdesc" select="2"/>
                             <field colspan="4" name="description" select="2"/>
                             <field name="installed_version"/>
                             <field name="latest_version"/>