Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Iliya Manolov
erp5
Commits
2a1e09ff
Commit
2a1e09ff
authored
Jun 14, 2013
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Interaction Workflow: allow configuring filters on a portal type group
parent
4aa03b09
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
84 additions
and
2 deletions
+84
-2
product/ERP5/Interaction.py
product/ERP5/Interaction.py
+5
-0
product/ERP5/dtml/interaction_properties.dtml
product/ERP5/dtml/interaction_properties.dtml
+15
-1
product/ERP5/dtml/interactions.dtml
product/ERP5/dtml/interactions.dtml
+5
-1
product/ERP5/tests/testInteractionWorkflow.py
product/ERP5/tests/testInteractionWorkflow.py
+50
-0
product/ERP5Type/Base.py
product/ERP5Type/Base.py
+9
-0
No files found.
product/ERP5/Interaction.py
View file @
2a1e09ff
...
...
@@ -57,6 +57,7 @@ class InteractionDefinition (SimpleItem):
activate_script_name
=
()
# Executed as activity
method_id
=
()
portal_type_filter
=
None
portal_type_group_filter
=
None
once_per_transaction
=
False
temporary_document_disallowed
=
False
...
...
@@ -117,6 +118,7 @@ class InteractionDefinition (SimpleItem):
def
setProperties
(
self
,
title
,
portal_type_filter
=
None
,
portal_type_group_filter
=
None
,
trigger_type
=
TRIGGER_WORKFLOW_METHOD
,
once_per_transaction
=
False
,
temporary_document_disallowed
=
False
,
...
...
@@ -139,6 +141,8 @@ class InteractionDefinition (SimpleItem):
self
.
method_id
=
method_id
if
portal_type_filter
is
not
None
and
'None'
in
portal_type_filter
:
portal_type_filter
=
None
if
portal_type_group_filter
is
not
None
and
'None'
in
portal_type_group_filter
:
portal_type_group_filter
=
None
if
'None'
in
after_script_name
:
after_script_name
=
()
if
'None'
in
activate_script_name
:
...
...
@@ -146,6 +150,7 @@ class InteractionDefinition (SimpleItem):
if
'None'
in
script_name
:
script_name
=
()
self
.
portal_type_filter
=
portal_type_filter
self
.
portal_type_group_filter
=
portal_type_group_filter
self
.
title
=
str
(
title
)
self
.
description
=
str
(
description
)
self
.
trigger_type
=
int
(
trigger_type
)
...
...
product/ERP5/dtml/interaction_properties.dtml
View file @
2a1e09ff
...
...
@@ -20,7 +20,7 @@
</tr>
<tr>
<th align="left">Filter</th>
<th align="left">
Portal Type
Filter</th>
<td>
<select name="portal_type_filter:list" multiple size="5">
<option value="None">(None)</option>
...
...
@@ -43,6 +43,20 @@
</td>
</tr>
<tr>
<th align="left">Portal Type Group Filter</th>
<td>
<select name="portal_type_group_filter:list" multiple size="5">
<option value="None">(None)</option>
<dtml-in "portal_types['Base Type'].getAvailableGroupList()" sort>
<dtml-let selected="_['sequence-item'] in (portal_type_group_filter or []) and 'selected' or ' '">
<option value="&dtml-sequence-item;" &dtml-selected;>&dtml-sequence-item;</option>
</dtml-let>
</dtml-in>
</select>
</td>
</tr>
<tr>
<th align="left">Trigger Method Id(s)</th>
<td><input type="text" name="method_id" value="<dtml-var "' '.join(method_id)">" size="50" /></td>
...
...
product/ERP5/dtml/interactions.dtml
View file @
2a1e09ff
...
...
@@ -36,7 +36,11 @@
<br />
</dtml-if>
<dtml-if portal_type_filter>
Filter: &dtml-portal_type_filter;
Portal Type Filter: &dtml-portal_type_filter;
<br />
</dtml-if>
<dtml-if portal_type_group_filter>
Portal Type Group Filter: &dtml-portal_type_group_filter;
<br />
</dtml-if>
<dtml-if method_id>
...
...
product/ERP5/tests/testInteractionWorkflow.py
View file @
2a1e09ff
...
...
@@ -678,6 +678,56 @@ context.setTitle('Bar')
self
.
assertEqual
(
'validated'
,
self
.
organisation
.
getValidationState
())
self
.
assertEqual
(
'titi'
,
self
.
organisation
.
getDescription
())
def
test_portal_type_filter
(
self
):
self
.
createInteractionWorkflow
()
self
.
getWorkflowTool
().
setChainForPortalTypes
(
[
'Bank Account'
],
'test_workflow, validation_workflow'
)
self
.
interaction
.
setProperties
(
'default'
,
# only for bank accounts
portal_type_filter
=
[
'Bank Account'
],
method_id
=
'getReference'
,
after_script_name
=
(
'afterEdit'
,))
params
=
'sci, **kw'
body
=
"context = sci[
\
'
object
\
'
]
\
n
"
+
\
"context.setDescription('modified')"
self
.
script
.
ZPythonScript_edit
(
params
,
body
)
bank_account
=
self
.
organisation
.
newContent
(
portal_type
=
'Bank Account'
)
self
.
assertEqual
(
''
,
bank_account
.
getDescription
())
self
.
organisation
.
getReference
()
self
.
assertEqual
(
''
,
self
.
organisation
.
getDescription
())
bank_account
.
getReference
()
self
.
assertEqual
(
'modified'
,
bank_account
.
getDescription
())
def
test_portal_type_group_filter
(
self
):
self
.
createInteractionWorkflow
()
self
.
getWorkflowTool
().
setChainForPortalTypes
(
[
'Bank Account'
],
'test_workflow, validation_workflow'
)
self
.
interaction
.
setProperties
(
'default'
,
# only for payment nodes portal type group (ie. bank account)
portal_type_group_filter
=
[
'payment_node'
],
method_id
=
'getReference'
,
after_script_name
=
(
'afterEdit'
,))
params
=
'sci, **kw'
body
=
"context = sci[
\
'
object
\
'
]
\
n
"
+
\
"context.setDescription('modified')"
self
.
script
.
ZPythonScript_edit
(
params
,
body
)
bank_account
=
self
.
organisation
.
newContent
(
portal_type
=
'Bank Account'
)
self
.
assertEqual
(
''
,
bank_account
.
getDescription
())
self
.
organisation
.
getReference
()
self
.
assertEqual
(
''
,
self
.
organisation
.
getDescription
())
bank_account
.
getReference
()
self
.
assertEqual
(
'modified'
,
bank_account
.
getDescription
())
def
test_suite
():
...
...
product/ERP5Type/Base.py
View file @
2a1e09ff
...
...
@@ -588,9 +588,18 @@ def initializePortalTypeDynamicWorkflowMethods(ptype_klass, portal_workflow):
for
wf_id
,
v
in
interaction_workflow_dict
.
iteritems
():
transition_id_set
,
trigger_dict
=
v
for
tr_id
,
tdef
in
trigger_dict
.
iteritems
():
# Check portal type filter
if
(
tdef
.
portal_type_filter
is
not
None
and
\
portal_type
not
in
tdef
.
portal_type_filter
):
continue
# Check portal type group filter
if
tdef
.
portal_type_group_filter
is
not
None
:
getPortalGroupedTypeSet
=
portal_workflow
.
getPortalObject
().
_getPortalGroupedTypeSet
if
not
any
(
portal_type
in
getPortalGroupedTypeSet
(
portal_type_group
)
for
portal_type_group
in
tdef
.
portal_type_group_filter
):
continue
for
imethod_id
in
tdef
.
method_id
:
if
wildcard_interaction_method_id_match
(
imethod_id
):
# Interactions workflows can use regexp based wildcard methods
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment