[MERGE] small code improvement

bzr revid: qdp-launchpad@openerp.com-20110704140506-j2o8m2pcak2p0c5m
This commit is contained in:
Quentin (OpenERP)
2011-07-04 16:05:06 +02:00
+14 -28
View File
@@ -40,6 +40,16 @@ from tools.translate import _
from osv import fields, osv, orm
ACTION_DICT = {
'view_type': 'form',
'view_mode': 'form',
'res_model': 'base.module.upgrade',
'target': 'new',
'type': 'ir.actions.act_window',
'nodestroy':True,
}
class module_category(osv.osv):
_name = "ir.module.category"
_description = "Module Category"
@@ -286,15 +296,7 @@ class module(osv.osv):
def button_install(self, cr, uid, ids, context=None):
self.state_update(cr, uid, ids, 'to install', ['uninstalled'], context)
return {
'name': _('Install'),
'view_type': 'form',
'view_mode': 'form',
'res_model': 'base.module.upgrade',
'target': 'new',
'type': 'ir.actions.act_window',
'nodestroy':True,
}
return dict(ACTION_DICT, name=_('Install'))
def button_install_cancel(self, cr, uid, ids, context=None):
@@ -315,15 +317,7 @@ class module(osv.osv):
if res:
raise orm.except_orm(_('Error'), _('Some installed modules depend on the module you plan to Uninstall :\n %s') % '\n'.join(map(lambda x: '\t%s: %s' % (x[0], x[1]), res)))
self.write(cr, uid, ids, {'state': 'to remove'})
return {
'name': _('Uninstall'),
'view_type': 'form',
'view_mode': 'form',
'res_model': 'base.module.upgrade',
'target': 'new',
'type': 'ir.actions.act_window',
'nodestroy':True,
}
return dict(ACTION_DICT, name=_('Uninstall'))
def button_uninstall_cancel(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state': 'installed'})
@@ -360,20 +354,12 @@ class module(osv.osv):
to_install.extend(ids2)
self.button_install(cr, uid, to_install, context=context)
return {
'name': _('Upgrade'),
'view_type': 'form',
'view_mode': 'form',
'res_model': 'base.module.upgrade',
'target': 'new',
'type': 'ir.actions.act_window',
'nodestroy':True,
}
# return True
return dict(ACTION_DICT, name=_('Upgrade'))
def button_upgrade_cancel(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state': 'installed'})
return True
def button_update_translations(self, cr, uid, ids, context=None):
self.update_translations(cr, uid, ids)
return True