Add domains on Action Window
review588002
This commit is contained in:
1 parent
5a28b9b8cb
commit
fa282b2271
11 files changed
+172
-2
No files matched your search
@@ -1,3 +1,5 @@
|
||||
* Add domains on Action Window
|
||||
|
||||
Version 2.6.0 - 2012-10-22
|
||||
* Bug fixes (see mercurial logs for details)
|
||||
* Add pre-validation
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
.. _topics-actions:
|
||||
|
||||
=======
|
||||
Actions
|
||||
=======
|
||||
|
||||
Actions are used to describe specific behaviors in the client.
|
||||
|
||||
There are four types of actions:
|
||||
|
||||
* Report
|
||||
|
||||
* Window
|
||||
|
||||
* Wizard
|
||||
|
||||
* URL
|
||||
|
||||
|
||||
Keyword
|
||||
-------
|
||||
|
||||
Keywords define where to display the action in the client.
|
||||
|
||||
There are six places:
|
||||
|
||||
* Open tree (`tree_open`)
|
||||
|
||||
* Action tree (`tree_action`)
|
||||
|
||||
* Print form (`form_print`)
|
||||
|
||||
* Action form (`form_action`)
|
||||
|
||||
* Form relate (`form_relate`)
|
||||
|
||||
* Open Graph (`graph_open`)
|
||||
|
||||
Report
|
||||
======
|
||||
|
||||
.. TODO
|
||||
|
||||
Window
|
||||
======
|
||||
|
||||
The window action describe how to create a new tab in the client.
|
||||
|
||||
View
|
||||
----
|
||||
|
||||
.. TODO
|
||||
|
||||
Domain
|
||||
------
|
||||
|
||||
The window action could have a list of domains which could be activated on the
|
||||
view.
|
||||
|
||||
Wizard
|
||||
======
|
||||
|
||||
.. TODO
|
||||
|
||||
URL
|
||||
===
|
||||
|
||||
.. TODO
|
||||
@@ -14,6 +14,7 @@ Introduction to all the key parts of trytond:
|
||||
models/fields_default_value
|
||||
domain
|
||||
pyson
|
||||
actions
|
||||
views/index
|
||||
views/extension
|
||||
wizard
|
||||
|
||||
@@ -47,6 +47,7 @@ def register():
|
||||
ActionReport,
|
||||
ActionActWindow,
|
||||
ActionActWindowView,
|
||||
ActionActWindowDomain,
|
||||
ActionWizard,
|
||||
ActionURL,
|
||||
Model,
|
||||
|
||||
+32
-2
@@ -15,8 +15,9 @@ from ..cache import Cache
|
||||
from ..rpc import RPC
|
||||
|
||||
__all__ = [
|
||||
'Action', 'ActionKeyword', 'ActionReport', 'ActionActWindow',
|
||||
'ActionActWindowView', 'ActionWizard', 'ActionURL',
|
||||
'Action', 'ActionKeyword', 'ActionReport',
|
||||
'ActionActWindow', 'ActionActWindowView', 'ActionActWindowDomain',
|
||||
'ActionWizard', 'ActionURL',
|
||||
]
|
||||
|
||||
EMAIL_REFKEYS = set(('cc', 'to', 'subject'))
|
||||
@@ -559,6 +560,9 @@ class ActionActWindow(ModelSQL, ModelView):
|
||||
act_window_views = fields.One2Many('ir.action.act_window.view',
|
||||
'act_window', 'Views')
|
||||
views = fields.Function(fields.Binary('Views'), 'get_views')
|
||||
act_window_domains = fields.One2Many('ir.action.act_window.domain',
|
||||
'act_window', 'Domains')
|
||||
domains = fields.Function(fields.Binary('Domains'), 'get_domains')
|
||||
limit = fields.Integer('Limit', required=True,
|
||||
help='Default limit for the list view')
|
||||
auto_refresh = fields.Integer('Auto-Refresh', required=True,
|
||||
@@ -695,6 +699,12 @@ class ActionActWindow(ModelSQL, ModelView):
|
||||
return [(view.view.id, view.view.type)
|
||||
for view in self.act_window_views]
|
||||
|
||||
def get_domains(self, name):
|
||||
encoder = PYSONEncoder()
|
||||
return [(domain.name,
|
||||
encoder.encode(safe_eval(domain.domain or '[]', CONTEXT)))
|
||||
for domain in self.act_window_domains]
|
||||
|
||||
@classmethod
|
||||
def get_pyson(cls, windows, name):
|
||||
pysons = {}
|
||||
@@ -815,6 +825,26 @@ class ActionActWindowView(ModelSQL, ModelView):
|
||||
pool.get('ir.action.keyword')._get_keyword_cache.clear()
|
||||
|
||||
|
||||
class ActionActWindowDomain(ModelSQL, ModelView):
|
||||
"Action act window domain"
|
||||
__name__ = 'ir.action.act_window.domain'
|
||||
name = fields.Char('Name', translate=True)
|
||||
sequence = fields.Integer('Sequence', required=True)
|
||||
domain = fields.Char('Domain')
|
||||
act_window = fields.Many2One('ir.action.act_window', 'Action',
|
||||
select=True, required=True, ondelete='CASCADE')
|
||||
active = fields.Boolean('Active')
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(ActionActWindowDomain, cls).__setup__()
|
||||
cls._order.insert(0, ('sequence', 'ASC'))
|
||||
|
||||
@staticmethod
|
||||
def default_active():
|
||||
return True
|
||||
|
||||
|
||||
class ActionWizard(ModelSQL, ModelView):
|
||||
"Action wizard"
|
||||
__name__ = 'ir.action.wizard'
|
||||
|
||||
@@ -124,6 +124,26 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">action_act_window_view_list2</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="act_window_domain_view_form">
|
||||
<field name="model">ir.action.act_window.domain</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">action_act_window_domain_form</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="act_window_domain_view_list">
|
||||
<field name="model">ir.action.act_window.domain</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="10"/>
|
||||
<field name="name">action_act_window_domain_list</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="act_window_domain_view_list2">
|
||||
<field name="model">ir.action.act_window.domain</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="20"/>
|
||||
<field name="name">action_act_window_domain_list2</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="action_wizard_view_form">
|
||||
<field name="model">ir.action.wizard</field>
|
||||
<field name="type">form</field>
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<form string="Domain" col="6">
|
||||
<label name="name"/>
|
||||
<field name="name"/>
|
||||
<label name="sequence"/>
|
||||
<field name="sequence"/>
|
||||
<label name="active"/>
|
||||
<field name="active"/>
|
||||
<label name="act_window"/>
|
||||
<field name="act_window"/>
|
||||
<newline/>
|
||||
<label name="domain"/>
|
||||
<field name="domain" colspan="5"/>
|
||||
</form>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tree string="Domains">
|
||||
<field name="act_window"/>
|
||||
<field name="name"/>
|
||||
<field name="domain"/>
|
||||
</tree>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tree string="Domains" sequence="sequence">
|
||||
<field name="sequence" tree_invisible="1"/>
|
||||
<field name="name" expand="1"/>
|
||||
</tree>
|
||||
@@ -16,6 +16,8 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="icon"/>
|
||||
<field name="act_window_views" colspan="6"
|
||||
view_ids="ir.act_window_view_view_list2"/>
|
||||
<field name="act_window_domains" colspan="6"
|
||||
view_ids="ir.act_window_domain_view_list2"/>
|
||||
<label name="domain"/>
|
||||
<field name="domain" colspan="5"/>
|
||||
<label name="context"/>
|
||||
|
||||
@@ -153,6 +153,21 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="perm_create" eval="True"/>
|
||||
<field name="perm_delete" eval="True"/>
|
||||
</record>
|
||||
<record model="ir.model.access" id="access_ir_action_act_window_domain">
|
||||
<field name="model" search="[('model', '=', 'ir.action.act_window.domain')]"/>
|
||||
<field name="perm_read" eval="True"/>
|
||||
<field name="perm_write" eval="False"/>
|
||||
<field name="perm_create" eval="False"/>
|
||||
<field name="perm_delete" eval="False"/>
|
||||
</record>
|
||||
<record model="ir.model.access" id="access_ir_action_act_window_domain_admin">
|
||||
<field name="model" search="[('model', '=', 'ir.action.act_window.domain')]"/>
|
||||
<field name="group" ref="group_admin"/>
|
||||
<field name="perm_read" eval="True"/>
|
||||
<field name="perm_write" eval="True"/>
|
||||
<field name="perm_create" eval="True"/>
|
||||
<field name="perm_delete" eval="True"/>
|
||||
</record>
|
||||
<record model="ir.model.access" id="access_ir_action_wizard">
|
||||
<field name="model" search="[('model', '=', 'ir.action.wizard')]"/>
|
||||
<field name="perm_read" eval="True"/>
|
||||
|
||||
Reference in new issue
Block a user