Merge tree and list views
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
* Merge tree and list views
|
||||
* Added autocompletion on fields.Char
|
||||
* Remove ir.default
|
||||
* Add type, last user and last modification on ir.attachment
|
||||
|
||||
@@ -22,6 +22,7 @@ So generally, they are defined in xml files with this kind of xml:
|
||||
<field name="model">model name</field>
|
||||
<field name="type">type name</field>
|
||||
<!--field name="inherit" ref="inherit_view_id"/-->
|
||||
<!--field name="field_childs">field name</field-->
|
||||
<field name="arch" type="xml">
|
||||
<![CDATA[
|
||||
View XML ...
|
||||
@@ -404,6 +405,10 @@ trytond/ir/ui/tree.rng. There is also a RNC in trytond/ir/ui/tree.rnc.
|
||||
|
||||
Tree view is used to display records inside a list or a tree.
|
||||
|
||||
It is a tree if there is a `field_childs` defined and this tree will
|
||||
have drag and drop activated if the `field_childs` and the `parent
|
||||
field` are defined in the view.
|
||||
|
||||
The columns of the view are put on the screen from left to right.
|
||||
|
||||
|
||||
@@ -437,8 +442,8 @@ Each tree view must start with this tag.
|
||||
* ``fill``: A boolean to specify if the last column must fill the remaining
|
||||
free space in the view.
|
||||
|
||||
* ``toolbar``: A boolean to specify on tree, if there is a toolbar on the
|
||||
left that takes the first elements of the tree (like for the menu).
|
||||
* ``keyword_open``: A boolean to specify if the client should look for a
|
||||
tree_open action on double click instead of switching view.
|
||||
|
||||
field
|
||||
^^^^^
|
||||
|
||||
+9
-8
@@ -62,7 +62,7 @@ class MenuitemTagHandler:
|
||||
|
||||
# TODO maybe use a prefetch for this:
|
||||
cursor.execute(cursor.limit_clause(
|
||||
"SELECT a.name, a.type, act.view_type, v.type, icon.name " \
|
||||
"SELECT a.name, a.type, v.type, v.field_childs, icon.name " \
|
||||
"FROM ir_action a " \
|
||||
"LEFT JOIN ir_action_report report ON (a.id = report.action) " \
|
||||
"LEFT JOIN ir_action_act_window act ON (a.id = act.action) " \
|
||||
@@ -78,7 +78,7 @@ class MenuitemTagHandler:
|
||||
"OR url.id = %s " \
|
||||
"ORDER by wv.sequence", 1),
|
||||
(action_id, action_id, action_id, action_id))
|
||||
action_name, action_type, view_type, view_mode, icon_name = \
|
||||
action_name, action_type, view_type, field_childs, icon_name = \
|
||||
cursor.fetchone()
|
||||
|
||||
values['action'] = '%s,%s' % (action_type, action_id)
|
||||
@@ -94,14 +94,15 @@ class MenuitemTagHandler:
|
||||
values['icon'] = 'tryton-print'
|
||||
elif action_type == 'ir.action.act_window':
|
||||
if view_type == 'tree':
|
||||
values['icon'] = 'tryton-tree'
|
||||
elif view_mode and view_mode.startswith('tree'):
|
||||
values['icon'] = 'tryton-list'
|
||||
elif view_mode and view_mode.startswith('form'):
|
||||
if field_childs:
|
||||
values['icon'] = 'tryton-tree'
|
||||
else:
|
||||
values['icon'] = 'tryton-list'
|
||||
elif view_type == 'form':
|
||||
values['icon'] = 'tryton-new'
|
||||
elif view_mode and view_mode.startswith('graph'):
|
||||
elif view_type == 'graph':
|
||||
values['icon'] = 'tryton-graph'
|
||||
elif view_mode and view_mode.startswith('calendar'):
|
||||
elif view_type == 'calendar':
|
||||
values['icon'] = 'tryton-calendar'
|
||||
elif action_type == 'ir.action.url':
|
||||
values['icon'] = 'tryton-web-browser'
|
||||
|
||||
+21
-5
@@ -390,11 +390,6 @@ class ActionActWindow(ModelSQL, ModelView):
|
||||
domain = fields.Char('Domain Value')
|
||||
context = fields.Char('Context Value')
|
||||
res_model = fields.Char('Model')
|
||||
view_type = fields.Selection([
|
||||
('tree','Tree'),
|
||||
('form','Form'),
|
||||
('board', 'Board'),
|
||||
], string='Type of view')
|
||||
act_window_views = fields.One2Many('ir.action.act_window.view',
|
||||
'act_window', 'Views')
|
||||
views = fields.Function(fields.Binary('Views'), 'get_views')
|
||||
@@ -417,11 +412,13 @@ class ActionActWindow(ModelSQL, ModelView):
|
||||
def __init__(self):
|
||||
super(ActionActWindow, self).__init__()
|
||||
self._constraints += [
|
||||
('check_views', 'invalid_views'),
|
||||
('check_domain', 'invalid_domain'),
|
||||
('check_context', 'invalid_context'),
|
||||
('check_search_value', 'invalid_search_value'),
|
||||
]
|
||||
self._error_messages.update({
|
||||
'invalid_views': 'Invalid views!',
|
||||
'invalid_domain': 'Invalid domain!',
|
||||
'invalid_context': 'Invalid context!',
|
||||
'invalid_search_value': 'Invalid search criteria!',
|
||||
@@ -448,6 +445,25 @@ class ActionActWindow(ModelSQL, ModelView):
|
||||
def default_search_value(self):
|
||||
return '{}'
|
||||
|
||||
def check_views(self, ids):
|
||||
"Check views"
|
||||
for action in self.browse(ids):
|
||||
if action.res_model:
|
||||
for act_window_view in action.act_window_views:
|
||||
view = act_window_view.view
|
||||
if view.model != action.res_model:
|
||||
return False
|
||||
if view.type == 'board':
|
||||
return False
|
||||
else:
|
||||
for act_window_view in action.act_window_views:
|
||||
view= act_window_view.view
|
||||
if view.model:
|
||||
return False
|
||||
if view.type != 'board':
|
||||
return False
|
||||
return True
|
||||
|
||||
def check_domain(self, ids):
|
||||
"Check domain"
|
||||
for action in self.browse(ids):
|
||||
|
||||
@@ -55,7 +55,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">Actions</field>
|
||||
<field name="type">ir.action.act_window</field>
|
||||
<field name="res_model">ir.action</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_action_form_view1">
|
||||
@@ -141,7 +140,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">Reports</field>
|
||||
<field name="type">ir.action.act_window</field>
|
||||
<field name="res_model">ir.action.report</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_action_report_form_view1">
|
||||
@@ -172,8 +170,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<page string="General" id="general" col="6">
|
||||
<label name="res_model"/>
|
||||
<field name="res_model"/>
|
||||
<label name="view_type"/>
|
||||
<field name="view_type"/>
|
||||
<label name="usage"/>
|
||||
<field name="usage"/>
|
||||
<field name="act_window_views" colspan="6">
|
||||
@@ -231,7 +227,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<tree string="Open Window">
|
||||
<field name="name" select="1"/>
|
||||
<field name="res_model" select="1"/>
|
||||
<field name="view_type" select="1"/>
|
||||
<field name="domain"/>
|
||||
</tree>
|
||||
]]>
|
||||
@@ -241,7 +236,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">Window Actions</field>
|
||||
<field name="type">ir.action.act_window</field>
|
||||
<field name="res_model">ir.action.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_action_act_window_view1">
|
||||
<field name="sequence" eval="1"/>
|
||||
@@ -316,7 +310,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">Wizards</field>
|
||||
<field name="type">ir.action.act_window</field>
|
||||
<field name="res_model">ir.action.wizard</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_action_wizard_form_view1">
|
||||
@@ -374,7 +367,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">Wizard Sizes</field>
|
||||
<field name="type">ir.action.act_window</field>
|
||||
<field name="res_model">ir.action.wizard_size</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_action_wizard_size_form_view1">
|
||||
@@ -445,7 +437,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">URLs</field>
|
||||
<field name="type">ir.action.act_window</field>
|
||||
<field name="res_model">ir.action.url</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_action_url_form_view1">
|
||||
|
||||
@@ -58,7 +58,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">Attachments</field>
|
||||
<field name="type">ir.action.act_window</field>
|
||||
<field name="res_model">ir.attachment</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_attachment_form_view1">
|
||||
|
||||
@@ -69,7 +69,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.action.act_window" id="act_cron_form">
|
||||
<field name="name">Scheduled Actions</field>
|
||||
<field name="res_model">ir.cron</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="context">{'active_test': False}</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
|
||||
@@ -34,7 +34,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">Exports</field>
|
||||
<field name="type">ir.action.act_window</field>
|
||||
<field name="res_model">ir.export</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_export_form_view1">
|
||||
|
||||
@@ -113,7 +113,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.action.act_window" id="act_lang_form">
|
||||
<field name="name">Languages</field>
|
||||
<field name="res_model">ir.lang</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="context">{'active_test': False}</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
|
||||
@@ -54,7 +54,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.action.act_window" id="act_model_form">
|
||||
<field name="name">Models</field>
|
||||
<field name="res_model">ir.model</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_model_form_view1">
|
||||
@@ -113,7 +112,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.action.act_window" id="act_model_fields_form">
|
||||
<field name="name">Fields</field>
|
||||
<field name="res_model">ir.model.field</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_model_fields_form_view1">
|
||||
@@ -173,7 +171,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.action.act_window" id="act_model_access_form">
|
||||
<field name="name">Models Access</field>
|
||||
<field name="res_model">ir.model.access</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_model_access_form_view1">
|
||||
@@ -230,7 +227,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.action.act_window" id="act_model_field_access_form">
|
||||
<field name="name">Fields Access</field>
|
||||
<field name="res_model">ir.model.field.access</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_model_field_access_form_view1">
|
||||
|
||||
@@ -76,7 +76,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">Modules</field>
|
||||
<field name="type">ir.action.act_window</field>
|
||||
<field name="res_model">ir.module.module</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[('name', '!=', 'test')]</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
@@ -110,7 +109,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.action.act_window" id="act_config_wizard_item_form">
|
||||
<field name="name">Config Wizard Items</field>
|
||||
<field name="res_model">ir.module.module.config_wizard.item</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_config_wizard_item_form_view1">
|
||||
|
||||
@@ -39,7 +39,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">Default Properties</field>
|
||||
<field name="type">ir.action.act_window</field>
|
||||
<field name="res_model">ir.property</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[('res','=',False)]</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
@@ -60,7 +59,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">Properties</field>
|
||||
<field name="type">ir.action.act_window</field>
|
||||
<field name="res_model">ir.property</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_property_form_view1">
|
||||
|
||||
@@ -57,7 +57,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.action.act_window" id="act_rule_group_form">
|
||||
<field name="name">Record Rules</field>
|
||||
<field name="res_model">ir.rule.group</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_rule_group_form_view1">
|
||||
|
||||
@@ -71,7 +71,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">Sequences</field>
|
||||
<field name="type">ir.action.act_window</field>
|
||||
<field name="res_model">ir.sequence</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="context">{'active_test': False}</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
@@ -111,7 +110,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">Sequences Strict</field>
|
||||
<field name="type">ir.action.act_window</field>
|
||||
<field name="res_model">ir.sequence.strict</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="context">{'active_test': False}</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
@@ -160,7 +158,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">Sequence Types</field>
|
||||
<field name="type">ir.action.act_window</field>
|
||||
<field name="res_model">ir.sequence.type</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_sequence_type_form_view1">
|
||||
|
||||
@@ -52,7 +52,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.action.act_window" id="act_translation_form">
|
||||
<field name="name">Translations</field>
|
||||
<field name="res_model">ir.translation</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[('module', '!=', False)]</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
|
||||
@@ -59,7 +59,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.action.act_window" id="act_trigger_form">
|
||||
<field name="name">Triggers</field>
|
||||
<field name="res_model">ir.trigger</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_trigger_form_view1">
|
||||
<field name="sequence" eval="10"/>
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
<record model="ir.action.act_window" id="act_icon_form">
|
||||
<field name="name">Icons</field>
|
||||
<field name="res_model">ir.ui.icon</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_icon_form_view1">
|
||||
|
||||
+12
-37
@@ -9,40 +9,12 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="field_childs">childs</field>
|
||||
<field name="arch" type="xml">
|
||||
<![CDATA[
|
||||
<tree string="Menu" toolbar="1">
|
||||
<tree string="Menu" keyword_open="1" fill="1">
|
||||
<field name="name" icon="icon"/>
|
||||
</tree>
|
||||
]]>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window" id="act_menu_tree">
|
||||
<field name="name">Menu</field>
|
||||
<field name="res_model">ir.ui.menu</field>
|
||||
<field name="view_type">tree</field>
|
||||
<field name="usage">menu</field>
|
||||
<field name="domain" eval="'[(\'parent\', \'=\', False)]'"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_menu_tree_view1">
|
||||
<field name="sequence" eval="1"/>
|
||||
<field name="view" ref="menu_view_tree_tree"/>
|
||||
<field name="act_window" ref="act_menu_tree"/>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="menu_view_tree">
|
||||
<field name="model">ir.ui.menu</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="8"/>
|
||||
<field name="arch" type="xml">
|
||||
<![CDATA[
|
||||
<tree string="Menu">
|
||||
<field name="complete_name" icon="icon"/>
|
||||
<field name="name" tree_invisible="1" select="1"/>
|
||||
<field name="parent" tree_invisible="1" select="1"/>
|
||||
<field name="active" tree_invisible="1" select="1"/>
|
||||
</tree>
|
||||
]]>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="menu_view_form">
|
||||
<field name="model">ir.ui.menu</field>
|
||||
<field name="type">form</field>
|
||||
@@ -69,24 +41,27 @@ this repository contains the full copyright notices and license terms. -->
|
||||
]]>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window" id="act_menu_form">
|
||||
<field name="name">Menus</field>
|
||||
|
||||
<record model="ir.action.act_window" id="act_menu_tree">
|
||||
<field name="name">Menu</field>
|
||||
<field name="res_model">ir.ui.menu</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="usage">menu</field>
|
||||
<field name="domain" eval="'[(\'parent\', \'=\', False)]'"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_menu_form_view1">
|
||||
id="act_menu_tree_view1">
|
||||
<field name="sequence" eval="1"/>
|
||||
<field name="view" ref="menu_view_tree"/>
|
||||
<field name="act_window" ref="act_menu_form"/>
|
||||
<field name="view" ref="menu_view_tree_tree"/>
|
||||
<field name="act_window" ref="act_menu_tree"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_menu_form_view2">
|
||||
<field name="sequence" eval="2"/>
|
||||
<field name="view" ref="menu_view_form"/>
|
||||
<field name="act_window" ref="act_menu_form"/>
|
||||
<field name="act_window" ref="act_menu_tree"/>
|
||||
</record>
|
||||
|
||||
<menuitem parent="menu_ui"
|
||||
action="act_menu_form" id="menu_menu_form"/>
|
||||
action="act_menu_tree" id="menu_menu_tree"/>
|
||||
</data>
|
||||
</tryton>
|
||||
|
||||
@@ -13,7 +13,7 @@ attlist.tree &= attribute colors { text }?
|
||||
attlist.tree &=
|
||||
[ a:defaultValue = "0" ] attribute fill { "0" | "1" }?
|
||||
attlist.tree &=
|
||||
[ a:defaultValue = "0" ] attribute toolbar { "0" | "1" }?
|
||||
[ a:defaultValue = "0" ] attribute keyword_open { "0" | "1" }?
|
||||
field = element field { attlist.field, empty }
|
||||
attlist.field &= attribute name { text }
|
||||
attlist.field &= attribute readonly { "0" | "1" }?
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
</define>
|
||||
<define name="attlist.tree" combine="interleave">
|
||||
<optional>
|
||||
<attribute name="toolbar" a:defaultValue="0">
|
||||
<attribute name="keyword_open" a:defaultValue="0">
|
||||
<choice>
|
||||
<value>0</value>
|
||||
<value>1</value>
|
||||
|
||||
@@ -10,6 +10,7 @@ from trytond.backend import TableHandler
|
||||
from trytond.pyson import PYSONEncoder, CONTEXT, Eval, Not, Bool, Equal
|
||||
from trytond.tools import safe_eval
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.wizard import Wizard
|
||||
|
||||
|
||||
class View(ModelSQL, ModelView):
|
||||
@@ -253,6 +254,81 @@ class ViewShortcut(ModelSQL, ModelView):
|
||||
ViewShortcut()
|
||||
|
||||
|
||||
class AddShortcut(Wizard):
|
||||
'Add shortcut'
|
||||
_name = 'ir.ui.view_sc.add'
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'result': {
|
||||
'type': 'action',
|
||||
'action': '_add_shortcut',
|
||||
'state': 'end',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
def _add_shortcut(self, data):
|
||||
view_sc_obj = self.pool.get('ir.ui.view_sc')
|
||||
model_obj = self.pool.get(data['model'])
|
||||
|
||||
record = model_obj.browse(data['id'])
|
||||
view_sc_obj.create({
|
||||
'name': record.rec_name,
|
||||
'res_id': record.id,
|
||||
'user_id': Transaction().user,
|
||||
'resource': model_obj._name,
|
||||
})
|
||||
return {}
|
||||
|
||||
AddShortcut()
|
||||
|
||||
|
||||
class OpenShortcut(Wizard):
|
||||
'Open a shortcut'
|
||||
_name = 'ir.ui.view_sc.open'
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'result': {
|
||||
'type': 'action',
|
||||
'action': '_open',
|
||||
'state': 'end',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def _open(self, data):
|
||||
view_sc_obj = self.pool.get('ir.ui.view_sc')
|
||||
action_keyword_obj = self.pool.get('ir.action.keyword')
|
||||
|
||||
view_sc = view_sc_obj.browse(data['id'])
|
||||
models = (
|
||||
'%s,%d' % (view_sc.resource, view_sc.res_id),
|
||||
'%s,0' % (view_sc.resource),
|
||||
)
|
||||
action_keyword_ids = None
|
||||
for model in models:
|
||||
action_keyword_ids = action_keyword_obj.search([
|
||||
('keyword', '=', 'tree_open'),
|
||||
('model', '=', model),
|
||||
])
|
||||
if action_keyword_ids:
|
||||
break
|
||||
if not action_keyword_ids:
|
||||
return {}
|
||||
action_keyword = action_keyword_obj.browse(action_keyword_ids[0])
|
||||
action_obj = self.pool.get(action_keyword.action.type)
|
||||
action_ids = action_obj.search([
|
||||
('action.id', '=', action_keyword.action.id),
|
||||
])
|
||||
if not action_ids:
|
||||
return {}
|
||||
return action_obj.read(action_ids[0])
|
||||
|
||||
OpenShortcut()
|
||||
|
||||
|
||||
class ViewTreeWidth(ModelSQL, ModelView):
|
||||
"View Tree Width"
|
||||
_name = 'ir.ui.view_tree_width'
|
||||
|
||||
+32
-1
@@ -69,7 +69,9 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<![CDATA[
|
||||
<form string="Shortcut">
|
||||
<label name="name"/>
|
||||
<field name="name"/>
|
||||
<field name="name" colspan="3"/>
|
||||
<label name="resource"/>
|
||||
<field name="resource"/>
|
||||
<label name="res_id"/>
|
||||
<field name="res_id"/>
|
||||
<label name="user_id"/>
|
||||
@@ -113,6 +115,35 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<menuitem parent="menu_ui"
|
||||
action="act_view_sc_form" id="menu_view_sc"/>
|
||||
|
||||
<record model="ir.ui.view" id="view_sc_view_board">
|
||||
<field name="model">ir.ui.view_sc</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<![CDATA[
|
||||
<tree string="Shortcuts" keyword_open="1" fill="1"
|
||||
sequence="sequence">
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
]]>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.action.wizard" id="act_view_sc_add">
|
||||
<field name="name">Add Shortcut</field>
|
||||
<field name="wiz_name">ir.ui.view_sc.add</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.action.wizard" id="act_view_sc_open">
|
||||
<field name="name">Open Shortcut</field>
|
||||
<field name="wiz_name">ir.ui.view_sc.open</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.action.keyword" id="act_view_sc_open_keyword1">
|
||||
<field name="action" ref="act_view_sc_open"/>
|
||||
<field name="keyword">tree_open</field>
|
||||
<field name="model">ir.ui.view_sc,0</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_tree_width_view_form">
|
||||
<field name="model">ir.ui.view_tree_width</field>
|
||||
<field name="type">form</field>
|
||||
|
||||
@@ -219,7 +219,8 @@ class ModelView(Model):
|
||||
# Update arch and compute fields from arch
|
||||
parser = etree.XMLParser(remove_blank_text=True)
|
||||
tree = etree.fromstring(result['arch'], parser)
|
||||
xarch, xfields = self._view_look_dom_arch(tree, result['type'])
|
||||
xarch, xfields = self._view_look_dom_arch(tree, result['type'],
|
||||
result['field_childs'])
|
||||
result['arch'] = xarch
|
||||
result['fields'] = xfields
|
||||
|
||||
@@ -255,7 +256,7 @@ class ModelView(Model):
|
||||
"""
|
||||
return value
|
||||
|
||||
def _view_look_dom_arch(self, tree, type):
|
||||
def _view_look_dom_arch(self, tree, type, field_children=None):
|
||||
field_access_obj = self.pool.get('ir.model.field.access')
|
||||
|
||||
fields_width = {}
|
||||
@@ -308,6 +309,17 @@ class ModelView(Model):
|
||||
fields_def = self.__view_look_dom(tree_root, type,
|
||||
fields_width=fields_width)
|
||||
|
||||
if field_children:
|
||||
fields_def.setdefault(field_children, {'name': field_children})
|
||||
model, field = None, None
|
||||
if field_children in self._columns:
|
||||
model = self
|
||||
field = self._columns[field_children]
|
||||
elif field_children in self._inherit_fields:
|
||||
model_name, model, field = self._inherit_fields[field_children]
|
||||
if model and field and field.model_name == model._name:
|
||||
fields_def.setdefault(field.field, {'name': field.field})
|
||||
|
||||
for field_name in fields_def.keys():
|
||||
if field_name in self._columns:
|
||||
field = self._columns[field_name]
|
||||
|
||||
@@ -47,7 +47,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">Groups</field>
|
||||
<field name="type">ir.action.act_window</field>
|
||||
<field name="res_model">res.group</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_group_form_view1">
|
||||
|
||||
+1
-1
@@ -444,7 +444,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.ui.menu" id="ir.menu_icon_form">
|
||||
<field name="groups" eval="[('add', ref('res.group_admin'))]"/>
|
||||
</record>
|
||||
<record model="ir.ui.menu" id="ir.menu_menu_form">
|
||||
<record model="ir.ui.menu" id="ir.menu_menu_tree">
|
||||
<field name="groups" eval="[('add', ref('res.group_admin'))]"/>
|
||||
</record>
|
||||
<record model="ir.ui.menu" id="ir.menu_view">
|
||||
|
||||
@@ -77,7 +77,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.action.act_window" id="act_request_form">
|
||||
<field name="name">Requests</field>
|
||||
<field name="res_model">res.request</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_request_form_view1">
|
||||
@@ -124,7 +123,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.action.act_window" id="act_request_link_form">
|
||||
<field name="name">Request Links</field>
|
||||
<field name="res_model">res.request.link</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_request_link_form_view1">
|
||||
|
||||
@@ -109,7 +109,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">Users</field>
|
||||
<field name="type">ir.action.act_window</field>
|
||||
<field name="res_model">res.user</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_user_form_view1">
|
||||
|
||||
+14
-26
@@ -14,6 +14,8 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<tree string="Collections">
|
||||
<field name="name"/>
|
||||
<field name="model"/>
|
||||
<field name="parent" tree_invisible="1"/>
|
||||
<field name="childs" tree_invisible="1"/>
|
||||
</tree>
|
||||
]]>
|
||||
</field>
|
||||
@@ -32,6 +34,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="model"/>
|
||||
<label name="domain"/>
|
||||
<field name="domain"/>
|
||||
<field name="childs" colspan="4"/>
|
||||
</form>
|
||||
]]>
|
||||
</field>
|
||||
@@ -40,56 +43,41 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">Collections</field>
|
||||
<field name="type">ir.action.act_window</field>
|
||||
<field name="res_model">webdav.collection</field>
|
||||
<field name="view_type">tree</field>
|
||||
<field name="domain">[('parent', '=', False)]</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_collection_tree_view1">
|
||||
<field name="sequence" eval="1"/>
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="view" ref="collection_view_tree"/>
|
||||
<field name="act_window" ref="act_collection_tree"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_collection_tree_view2">
|
||||
<field name="sequence" eval="20"/>
|
||||
<field name="view" ref="collection_view_form"/>
|
||||
<field name="act_window" ref="act_collection_tree"/>
|
||||
</record>
|
||||
<menuitem parent="menu_webdav" groups="res.group_admin"
|
||||
action="act_collection_tree" id="menu_collection_tree"/>
|
||||
|
||||
<record model="ir.action.act_window" id="act_collection_form">
|
||||
<field name="name">Collections</field>
|
||||
<field name="res_model">webdav.collection</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_collection_form_view1">
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="view" ref="collection_view_tree"/>
|
||||
<field name="view" ref="collection_view_form"/>
|
||||
<field name="act_window" ref="act_collection_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_collection_form_view2">
|
||||
<field name="sequence" eval="20"/>
|
||||
<field name="view" ref="collection_view_form"/>
|
||||
<field name="view" ref="collection_view_tree"/>
|
||||
<field name="act_window" ref="act_collection_form"/>
|
||||
</record>
|
||||
<menuitem name="Edit Collections" parent="menu_collection_tree"
|
||||
action="act_collection_form" id="menu_collection_form"
|
||||
groups="res.group_admin"/>
|
||||
<record model="ir.action.act_window" id="act_collection_form2">
|
||||
<field name="name">Collections</field>
|
||||
<field name="res_model">webdav.collection</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_collection_form2_view1">
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="view" ref="collection_view_form"/>
|
||||
<field name="act_window" ref="act_collection_form2"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_collection_form2_view2">
|
||||
<field name="sequence" eval="20"/>
|
||||
<field name="view" ref="collection_view_tree"/>
|
||||
<field name="act_window" ref="act_collection_form2"/>
|
||||
</record>
|
||||
<menuitem name="New Collection" parent="menu_collection_tree"
|
||||
action="act_collection_form2" id="menu_collection_form2"
|
||||
action="act_collection_form" id="menu_collection_form"
|
||||
groups="res.group_admin"/>
|
||||
</data>
|
||||
</tryton>
|
||||
|
||||
@@ -38,7 +38,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.action.act_window" id="act_workflow_form">
|
||||
<field name="name">Workflows</field>
|
||||
<field name="res_model">workflow</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_workflow_form_view1">
|
||||
@@ -170,7 +169,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.action.act_window" id="act_activity_form">
|
||||
<field name="name">Activities</field>
|
||||
<field name="res_model">workflow.activity</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_activity_form_view1">
|
||||
@@ -245,7 +243,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.action.act_window" id="act_transition_form">
|
||||
<field name="name">Transitions</field>
|
||||
<field name="res_model">workflow.transition</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_transition_form_view1">
|
||||
@@ -314,7 +311,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.action.act_window" id="act_instance_form">
|
||||
<field name="name">Instances</field>
|
||||
<field name="res_model">workflow.instance</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_instance_form_view1">
|
||||
@@ -366,7 +362,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.action.act_window" id="act_workitem_form">
|
||||
<field name="name">Workitems</field>
|
||||
<field name="res_model">workflow.workitem</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_workitem_form_view1">
|
||||
|
||||
Reference in New Issue
Block a user