Remove ir.action.wizard_size

This commit is contained in:
Cédric Krier
2011-08-02 11:09:13 +02:00
parent e30b650480
commit c9ffdfffff
5 changed files with 1 additions and 147 deletions
+1
View File
@@ -1,3 +1,4 @@
* Remove ir.action.wizard_size
* Rename expand and fill attributes into yexpand and yfill
* Add xalign and yalign as field attributes
* Drop support of Python 2.5
-83
View File
@@ -663,89 +663,6 @@ class ActionWizard(ModelSQL, ModelView):
ActionWizard()
class ActionWizardSize(ModelSQL, ModelView):
"Action Wizard Size"
_name = 'ir.action.wizard_size'
_description = __doc__
wizard = fields.Char('Wizard', required=True, select=1)
model = fields.Char('Model', required=True, select=1)
user = fields.Many2One('res.user', 'User', required=True,
ondelete='CASCADE', select=1)
width = fields.Integer('Width')
height = fields.Integer('Height')
def __init__(self):
super(ActionWizardSize, self).__init__()
self._rpc.update({
'set_size': True,
})
def create(self, vals):
res = super(ActionWizardSize, self).create(vals)
# Restart the cache for get_size
self.get_size.reset()
return res
def write(self, ids, vals):
res = super(ActionWizardSize, self).write(ids, vals)
# Restart the cache for get_size
self.get_size.reset()
return res
def delete(self, ids):
res = super(ActionWizardSize, self).delete(ids)
# Restart the cache for get_size
self.get_size.reset()
return res
def set_size(self, wizard, model, width, height):
'''
Set size for wizard dialog.
:param wizard: the wizard name
:param model: the model name
:param width: the width
:param height: the height
'''
ids = self.search([
('user', '=', Transaction().user),
('wizard', '=', wizard),
('model', '=', model),
])
if ids:
self.write(ids, {
'width': width,
'height': height,
})
else:
self.create({
'wizard': wizard,
'model': model,
'user': Transaction().user,
'width': width,
'height': height,
})
@Cache('ir.action.wizard_size.get_size')
def get_size(self, wizard, model):
'''
Get size for wizard dialog.
:param wizard: the wizard name
:param model: the model name
:return: (width, height)
'''
ids = self.search([
('user', '=', Transaction().user),
('wizard', '=', wizard),
('model', '=', model),
], limit=1)
if ids:
wizard_size = self.browse(ids[0])
return wizard_size.width, wizard_size.height
return (0, 0)
ActionWizardSize()
class ActionURL(ModelSQL, ModelView):
"Action URL"
_name = 'ir.action.url'
-57
View File
@@ -331,63 +331,6 @@ this repository contains the full copyright notices and license terms. -->
<menuitem parent="menu_action"
action="act_action_wizard_form" id="menu_action_wizard"/>
<record model="ir.ui.view" id="action_wizard_size_view_form">
<field name="model">ir.action.wizard_size</field>
<field name="type">form</field>
<field name="arch" type="xml">
<![CDATA[
<form string="Wizard Size">
<label name="wizard"/>
<field name="wizard"/>
<label name="model"/>
<field name="model"/>
<label name="user"/>
<field name="user"/>
<newline/>
<label name="width"/>
<field name="width"/>
<label name="height"/>
<field name="height"/>
</form>
]]>
</field>
</record>
<record model="ir.ui.view" id="action_wizard_size_view_tree">
<field name="model">ir.action.wizard_size</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<![CDATA[
<tree string="Wizard Sizes">
<field name="wizard"/>
<field name="model"/>
<field name="user"/>
<field name="width"/>
<field name="height"/>
</tree>
]]>
</field>
</record>
<record model="ir.action.act_window" id="act_action_wizard_size_form">
<field name="name">Wizard Sizes</field>
<field name="type">ir.action.act_window</field>
<field name="res_model">ir.action.wizard_size</field>
</record>
<record model="ir.action.act_window.view"
id="act_action_wizard_size_form_view1">
<field name="sequence" eval="1"/>
<field name="view" ref="action_wizard_size_view_tree"/>
<field name="act_window" ref="act_action_wizard_size_form"/>
</record>
<record model="ir.action.act_window.view"
id="act_action_wizard_size_form_view2">
<field name="sequence" eval="2"/>
<field name="view" ref="action_wizard_size_view_form"/>
<field name="act_window" ref="act_action_wizard_size_form"/>
</record>
<menuitem parent="menu_action_wizard"
action="act_action_wizard_size_form" id="menu_action_wizard_size"/>
<record model="ir.ui.view" id="action_url_view_form">
<field name="model">ir.action.url</field>
<field name="type">form</field>
-4
View File
@@ -486,10 +486,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="menu" ref="ir.menu_action_wizard"/>
<field name="group" ref="group_admin"/>
</record>
<record model="ir.ui.menu-res.group" id="menu_action_wizard_size_group_admin">
<field name="menu" ref="ir.menu_action_wizard_size"/>
<field name="group" ref="group_admin"/>
</record>
<record model="ir.ui.menu-res.group" id="menu_action_url_group_admin">
<field name="menu" ref="ir.menu_action_url"/>
<field name="group" ref="group_admin"/>
-3
View File
@@ -103,7 +103,6 @@ class Wizard(WarningErrorMixin, URLMixin):
def execute(self, wiz_id, data, state='init'):
pool = Pool()
translation_obj = pool.get('ir.translation')
wizard_size_obj = pool.get('ir.action.wizard_size')
res = {}
if self._datas.get(wiz_id, {}).get('user') != Transaction().user:
@@ -159,8 +158,6 @@ class Wizard(WarningErrorMixin, URLMixin):
res['fields'] = fields
res['arch'] = arch
res['state'] = button_list
res['size'] = wizard_size_obj.get_size(self._name,
result_def['object'])
elif result_def['type'] == 'choice':
next_state = getattr(self, result_def['next_state'])(data)
if next_state == 'end':