diff --git a/CHANGELOG b/CHANGELOG
index 0ae4ff43e8..3a42a97965 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -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
diff --git a/doc/topics/actions.rst b/doc/topics/actions.rst
new file mode 100644
index 0000000000..015a5f1dcb
--- /dev/null
+++ b/doc/topics/actions.rst
@@ -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
diff --git a/doc/topics/index.rst b/doc/topics/index.rst
index b318d98faa..ad1fcaec65 100644
--- a/doc/topics/index.rst
+++ b/doc/topics/index.rst
@@ -14,6 +14,7 @@ Introduction to all the key parts of trytond:
models/fields_default_value
domain
pyson
+ actions
views/index
views/extension
wizard
diff --git a/trytond/ir/__init__.py b/trytond/ir/__init__.py
index 3f073ee3f0..708db4013f 100644
--- a/trytond/ir/__init__.py
+++ b/trytond/ir/__init__.py
@@ -47,6 +47,7 @@ def register():
ActionReport,
ActionActWindow,
ActionActWindowView,
+ ActionActWindowDomain,
ActionWizard,
ActionURL,
Model,
diff --git a/trytond/ir/action.py b/trytond/ir/action.py
index ba96d8deb3..69fb47b52d 100644
--- a/trytond/ir/action.py
+++ b/trytond/ir/action.py
@@ -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'
diff --git a/trytond/ir/action.xml b/trytond/ir/action.xml
index ff78767535..153a5353aa 100644
--- a/trytond/ir/action.xml
+++ b/trytond/ir/action.xml
@@ -124,6 +124,26 @@ this repository contains the full copyright notices and license terms. -->
action_act_window_view_list2
+
+ ir.action.act_window.domain
+ form
+ action_act_window_domain_form
+
+
+
+ ir.action.act_window.domain
+ tree
+
+ action_act_window_domain_list
+
+
+
+ ir.action.act_window.domain
+ tree
+
+ action_act_window_domain_list2
+
+
ir.action.wizard
form
diff --git a/trytond/ir/view/action_act_window_domain_form.xml b/trytond/ir/view/action_act_window_domain_form.xml
new file mode 100644
index 0000000000..dfe43cae49
--- /dev/null
+++ b/trytond/ir/view/action_act_window_domain_form.xml
@@ -0,0 +1,16 @@
+
+
+
diff --git a/trytond/ir/view/action_act_window_domain_list.xml b/trytond/ir/view/action_act_window_domain_list.xml
new file mode 100644
index 0000000000..b605257b17
--- /dev/null
+++ b/trytond/ir/view/action_act_window_domain_list.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
diff --git a/trytond/ir/view/action_act_window_domain_list2.xml b/trytond/ir/view/action_act_window_domain_list2.xml
new file mode 100644
index 0000000000..4f1783880e
--- /dev/null
+++ b/trytond/ir/view/action_act_window_domain_list2.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
diff --git a/trytond/ir/view/action_act_window_form.xml b/trytond/ir/view/action_act_window_form.xml
index 3987f2d9b0..4ab4277de5 100644
--- a/trytond/ir/view/action_act_window_form.xml
+++ b/trytond/ir/view/action_act_window_form.xml
@@ -16,6 +16,8 @@ this repository contains the full copyright notices and license terms. -->
+
diff --git a/trytond/res/ir.xml b/trytond/res/ir.xml
index 2ead78b4c8..f60487780a 100644
--- a/trytond/res/ir.xml
+++ b/trytond/res/ir.xml
@@ -153,6 +153,21 @@ this repository contains the full copyright notices and license terms. -->
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+