Add wizard to show views

review133001
This commit is contained in:
Cédric Krier
2011-10-04 19:50:39 +02:00
parent 75a517f931
commit fde60bc22a
3 changed files with 63 additions and 0 deletions
+1
View File
@@ -1,3 +1,4 @@
* Add wizard to show views
* Switched from .csv to .po for translations
* Search on Many2One fields include inactive records
* Change select on fields into Boolean
+51
View File
@@ -233,6 +233,57 @@ class View(ModelSQL, ModelView):
View()
class ShowViewInit(ModelView):
'Show view init'
_name = 'ir.ui.view.show.init'
ShowViewInit()
class ShowView(Wizard):
'Show view'
_name = 'ir.ui.view.show'
states = {
'init': {
'result': {
'type': 'form',
'object': 'ir.ui.view.show.init',
'state': [
('end', 'Close', 'tryton-cancel', True),
],
},
},
}
def __init__(self):
super(ShowView, self).__init__()
self._error_messages.update({
'view_type': 'Only "form" view can be shown!',
})
def execute(self, wiz_id, data, state='init'):
pool = Pool()
view_obj = pool.get('ir.ui.view')
result = super(ShowView, self).execute(wiz_id, data, state=state)
view = view_obj.browse(data['id'])
view_id = view.id
view_type = view.type
if view.inherit:
view_id = view.inherit.id
view_type = view.inherit.type
if view_type != 'form':
self.raise_user_error('view_type')
model_obj = pool.get(view.model)
fields_view = model_obj.fields_view_get(view_id=view.id)
result['fields'] = fields_view['fields']
result['arch'] = fields_view['arch']
result['object'] = view.model
return result
ShowView()
class ViewShortcut(ModelSQL, ModelView):
"View shortcut"
_name = 'ir.ui.view_sc'
+11
View File
@@ -3,6 +3,12 @@
this repository contains the full copyright notices and license terms. -->
<tryton>
<data>
<record model="ir.action.wizard" id="act_view_show">
<field name="name">Show View</field>
<field name="wiz_name">ir.ui.view.show</field>
</record>
<record model="ir.ui.view" id="view_view_form">
<field name="model">ir.ui.view</field>
<field name="type">form</field>
@@ -23,6 +29,11 @@ this repository contains the full copyright notices and license terms. -->
<field name="field_childs"/>
<separator name="arch" colspan="4"/>
<field name="arch" colspan="4"/>
<button name="%(act_view_show)d"
string="_Show"
type="action"
colspan="4"
/>
</form>
]]>
</field>