Simplify buttons of module
This commit is contained in:
1 parent
e994731e14
commit
9058fc381d
4 files changed
+32
-59
No files matched your search
@@ -68,24 +68,17 @@ class Module(ModelSQL, ModelView):
|
||||
'invisible': Eval('state') != 'not activated',
|
||||
'depends': ['state'],
|
||||
},
|
||||
'activate_cancel': {
|
||||
'invisible': Eval('state') != 'to activate',
|
||||
'depends': ['state'],
|
||||
},
|
||||
'deactivate': {
|
||||
'invisible': Eval('state') != 'activated',
|
||||
'depends': ['state'],
|
||||
},
|
||||
'deactivate_cancel': {
|
||||
'invisible': Eval('state') != 'to remove',
|
||||
'depends': ['state'],
|
||||
},
|
||||
'upgrade': {
|
||||
'invisible': Eval('state') != 'activated',
|
||||
'depends': ['state'],
|
||||
},
|
||||
'upgrade_cancel': {
|
||||
'invisible': Eval('state') != 'to upgrade',
|
||||
'cancel': {
|
||||
'invisible': ~Eval('state').in_(
|
||||
['to activate', 'to remove', 'to upgrade']),
|
||||
'depends': ['state'],
|
||||
},
|
||||
})
|
||||
@@ -194,14 +187,6 @@ class Module(ModelSQL, ModelView):
|
||||
'state': 'to upgrade',
|
||||
})
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
@filter_state('to activate')
|
||||
def activate_cancel(cls, modules):
|
||||
cls.write(modules, {
|
||||
'state': 'not activated',
|
||||
})
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
@filter_state('activated')
|
||||
@@ -228,14 +213,26 @@ class Module(ModelSQL, ModelView):
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
def cancel(cls, modules):
|
||||
cls._cancel_activate(modules)
|
||||
cls._cancel_remove(modules)
|
||||
cls._cancel_upgrade(modules)
|
||||
|
||||
@classmethod
|
||||
@filter_state('to activate')
|
||||
def _cancel_activate(cls, modules):
|
||||
cls.write(modules, {
|
||||
'state': 'not activated',
|
||||
})
|
||||
|
||||
@classmethod
|
||||
@filter_state('to remove')
|
||||
def deactivate_cancel(cls, modules):
|
||||
def _cancel_remove(cls, modules):
|
||||
cls.write(modules, {'state': 'not activated'})
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
@filter_state('to upgrade')
|
||||
def upgrade_cancel(cls, modules):
|
||||
def _cancel_upgrade(cls, modules):
|
||||
cls.write(modules, {'state': 'activated'})
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -45,60 +45,40 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.model.button" id="module_activate_button">
|
||||
<field name="model">ir.module</field>
|
||||
<field name="name">activate</field>
|
||||
<field name="string">Mark for Activation</field>
|
||||
<field name="string">Activate</field>
|
||||
</record>
|
||||
<record model="ir.model.button-res.group" id="module_activate_button_group_admin">
|
||||
<field name="button" ref="module_activate_button"/>
|
||||
<field name="group" ref="res.group_admin"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.model.button" id="module_activate_cancel_button">
|
||||
<field name="model">ir.module</field>
|
||||
<field name="name">activate_cancel</field>
|
||||
<field name="string">Cancel Activation</field>
|
||||
</record>
|
||||
<record model="ir.model.button-res.group" id="module_activate_cancel_button_group_admin">
|
||||
<field name="button" ref="module_activate_cancel_button"/>
|
||||
<field name="group" ref="res.group_admin"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.model.button" id="module_deactivate_button">
|
||||
<field name="model">ir.module</field>
|
||||
<field name="name">deactivate</field>
|
||||
<field name="string">Mark for Deactivation (beta)</field>
|
||||
<field name="string">Deactivate (beta)</field>
|
||||
</record>
|
||||
<record model="ir.model.button-res.group" id="module_deactivate_button_group_admin">
|
||||
<field name="button" ref="module_deactivate_button"/>
|
||||
<field name="group" ref="res.group_admin"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.model.button" id="module_deactivate_cancel_button">
|
||||
<field name="model">ir.module</field>
|
||||
<field name="name">deactivate_cancel</field>
|
||||
<field name="string">Cancel Deactivation</field>
|
||||
</record>
|
||||
<record model="ir.model.button-res.group" id="module_deactivate_cancel_button_group_admin">
|
||||
<field name="button" ref="module_deactivate_cancel_button"/>
|
||||
<field name="group" ref="res.group_admin"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.model.button" id="module_upgrade_button">
|
||||
<field name="model">ir.module</field>
|
||||
<field name="name">upgrade</field>
|
||||
<field name="string">Mark for Upgrade</field>
|
||||
<field name="string">Upgrade</field>
|
||||
</record>
|
||||
<record model="ir.model.button-res.group" id="module_upgrade_button_group_admin">
|
||||
<field name="button" ref="module_upgrade_button"/>
|
||||
<field name="group" ref="res.group_admin"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.model.button" id="module_upgrade_cancel_button">
|
||||
<record model="ir.model.button" id="module_cancel_button">
|
||||
<field name="model">ir.module</field>
|
||||
<field name="name">upgrade_cancel</field>
|
||||
<field name="string">Cancel Upgrade</field>
|
||||
<field name="name">cancel</field>
|
||||
<field name="string">Cancel</field>
|
||||
</record>
|
||||
<record model="ir.model.button-res.group" id="module_upgrade_cancel_button_group_admin">
|
||||
<field name="button" ref="module_upgrade_cancel_button"/>
|
||||
<record model="ir.model.button-res.group" id="module_cancel_button_group_admin">
|
||||
<field name="button" ref="module_cancel_button"/>
|
||||
<field name="group" ref="res.group_admin"/>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -10,11 +10,9 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<label name="state"/>
|
||||
<field name="state" readonly="1"/>
|
||||
<group col="-1" colspan="2" id="button">
|
||||
<button string="Mark for Upgrade" name="upgrade"/>
|
||||
<button string="Mark for Deactivation (beta)" name="deactivate"/>
|
||||
<button string="Mark for Activation" name="activate"/>
|
||||
<button string="Cancel Activation" name="activate_cancel"/>
|
||||
<button string="Cancel Upgrade" name="upgrade_cancel"/>
|
||||
<button string="Cancel Deactivation" name="deactivate_cancel"/>
|
||||
<button name="upgrade"/>
|
||||
<button name="deactivate"/>
|
||||
<button name="activate"/>
|
||||
<button name="cancel"/>
|
||||
</group>
|
||||
</form>
|
||||
@@ -5,8 +5,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name" expand="1"/>
|
||||
<field name="version" optional="1"/>
|
||||
<field name="state"/>
|
||||
<button string="Mark for Upgrade" name="upgrade"/>
|
||||
<button string="Mark for Activation" name="activate"/>
|
||||
<button string="Cancel Activation" name="activate_cancel"/>
|
||||
<button string="Cancel Upgrade" name="upgrade_cancel"/>
|
||||
<button name="activate"/>
|
||||
<button name="cancel"/>
|
||||
</tree>
|
||||
Reference in new issue
Block a user