[IMP] BASE: Now we can Inatall and Uninstall with only one Btn

bzr revid: aag@tinyerp.co.in-20110324094305-tls5c7bpn70a8cmd
This commit is contained in:
aag (OpenERP) 2011-03-24 15:13:05 +05:30
parent d02ffafe30
commit df95b01bd5
3 changed files with 21 additions and 8 deletions

View File

@ -286,7 +286,17 @@ class module(osv.osv):
return demo
def button_install(self, cr, uid, ids, context=None):
return self.state_update(cr, uid, ids, 'to install', ['uninstalled'], context)
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,
}
def button_install_cancel(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state': 'uninstalled', 'demo':False})
@ -306,7 +316,15 @@ 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 True
return {
'name': _('Uninstall'),
'view_type': 'form',
'view_mode': 'form',
'res_model': 'base.module.upgrade',
'target': 'new',
'type': 'ir.actions.act_window',
'nodestroy':True,
}
def button_uninstall_cancel(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state': 'installed'})

View File

@ -112,7 +112,7 @@
<newline/>
<field name="state" readonly="1" select="1"/>
<group col="6" colspan="2">
<button name="button_install" states="uninstalled" string="Schedule for Installation" icon="terp-gtk-jump-to-ltr" type="object"/>
<button name="button_install" states="uninstalled" string="Install" icon="terp-gtk-jump-to-ltr" type="object"/>
<button name="button_install_cancel" states="to install" string="Cancel Install" icon="gtk-cancel" type="object"/>
<button name="button_uninstall" states="installed" string="Uninstall (beta)" icon="terp-dialog-close" type="object"/>
<button name="button_uninstall_cancel" states="to remove" string="Cancel Uninstall" icon="gtk-cancel" type="object"/>

View File

@ -37,11 +37,6 @@
parent="menu_management"
sequence="3"/>
<act_window id="action_view_base_module_upgrade_window"
key2="client_action_multi" name="Apply Scheduled Upgrades"
res_model="base.module.upgrade" src_model="ir.module.module"
view_mode="form" target="new" view_type="form" />
<record id="view_base_module_upgrade_install" model="ir.ui.view">
<field name="name">Module Upgrade Install</field>
<field name="model">base.module.upgrade</field>