Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ayush Tiwari
erp5
Commits
0e2ed43f
Commit
0e2ed43f
authored
May 11, 2018
by
Tomáš Peterka
Committed by
Tomáš Peterka
May 15, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_core] Update code of Mass Workflow Transition for performance
parent
7cccbe9d
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
48 additions
and
19 deletions
+48
-19
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getFormIdForWorkflowAction.py
...portal_skins/erp5_core/Base_getFormIdForWorkflowAction.py
+11
-6
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getFormIdForWorkflowAction.xml
...ortal_skins/erp5_core/Base_getFormIdForWorkflowAction.xml
+1
-1
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getListbox.py
...kinTemplateItem/portal_skins/erp5_core/Base_getListbox.py
+6
-1
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_searchUsingListbox.py
...ateItem/portal_skins/erp5_core/Base_searchUsingListbox.py
+8
-8
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_searchUsingListbox.xml
...teItem/portal_skins/erp5_core/Base_searchUsingListbox.xml
+1
-1
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_modifyDocumentListStatus.py
...portal_skins/erp5_core/Folder_modifyDocumentListStatus.py
+20
-1
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_modifyDocumentListStatus.xml
...ortal_skins/erp5_core/Folder_modifyDocumentListStatus.xml
+1
-1
No files found.
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getFormIdForWorkflowAction.py
View file @
0e2ed43f
...
@@ -20,17 +20,22 @@ Format of Action returned by getFilteredActions['workflow'] = [{
...
@@ -20,17 +20,22 @@ Format of Action returned by getFilteredActions['workflow'] = [{
action_tool
=
context
.
getPortalObject
().
portal_actions
action_tool
=
context
.
getPortalObject
().
portal_actions
id_form_dict
=
dict
()
id_form_dict
=
dict
()
for
result
in
context
.
Base_searchUsingFormIdAndQuery
(
form_id
,
query
):
result_list
=
()
if
uids
is
not
None
:
result_list
=
context
.
getPortalObject
().
portal_catalog
(
uid
=
uids
)
else
:
result_list
=
context
.
Base_searchUsingFormIdAndQuery
(
form_id
,
query
)
for
result
in
result_list
:
for
action
in
action_tool
.
listFilteredActionsFor
(
result
.
getObject
()).
get
(
'workflow'
,
[]):
for
action
in
action_tool
.
listFilteredActionsFor
(
result
.
getObject
()).
get
(
'workflow'
,
[]):
id_form_dict
[
action
[
'id'
]]
=
action
[
'url'
].
rsplit
(
'/'
,
1
)[
1
].
split
(
'?'
)[
0
]
action_form_id
=
action
[
'url'
].
rsplit
(
'/'
,
1
)[
1
].
split
(
'?'
)[
0
]
id_form_dict
[
action
[
'id'
]]
=
action_form_id
if
workflow_action
==
action
[
'id'
]:
return
action_form_id
# early return for performance reasons
if
not
workflow_action
and
len
(
id_form_dict
)
==
1
:
if
not
workflow_action
and
len
(
id_form_dict
)
==
1
:
# if we have only one possible workflow transition we suppose it is the default one
# if we have only one possible workflow transition we suppose it is the default one
return
id_form_dict
.
items
()[
0
][
1
]
return
id_form_dict
.
items
()[
0
][
1
]
if
workflow_action
in
id_form_dict
:
# if the workflow_action is done and we found it then return related form dialog
return
id_form_dict
[
workflow_action
]
# if we have no idea what workflow form we should use - just use ~~the default one~~ nothing
# if we have no idea what workflow form we should use - just use ~~the default one~~ nothing
return
""
return
""
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getFormIdForWorkflowAction.xml
View file @
0e2ed43f
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
form_id, query
, workflow_action=\'\'
</string>
</value>
<value>
<string>
form_id, query
=\'\', workflow_action=\'\', uids=None
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getListbox.py
View file @
0e2ed43f
...
@@ -6,6 +6,7 @@ This script should be used to detect a listbox without having to name it "listbo
...
@@ -6,6 +6,7 @@ This script should be used to detect a listbox without having to name it "listbo
Christophe Dumez <christophe@nexedi.com>
Christophe Dumez <christophe@nexedi.com>
"""
"""
from
Products.ERP5Type.Log
import
log
,
ERROR
def
isListBox
(
field
):
def
isListBox
(
field
):
if
field
.
meta_type
==
"ListBox"
:
if
field
.
meta_type
==
"ListBox"
:
...
@@ -19,7 +20,11 @@ def isListBox(field):
...
@@ -19,7 +20,11 @@ def isListBox(field):
if
form_or_id
is
None
:
if
form_or_id
is
None
:
form
=
context
form
=
context
elif
isinstance
(
form_or_id
,
str
):
elif
isinstance
(
form_or_id
,
str
):
try
:
form
=
getattr
(
context
,
form_or_id
)
form
=
getattr
(
context
,
form_or_id
)
except
AttributeError
:
log
(
"Form '{}' does not exist!"
,
level
=
ERROR
)
return
None
else
:
else
:
form
=
form_or_id
form
=
form_or_id
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_searchUsingListbox.py
View file @
0e2ed43f
...
@@ -8,18 +8,18 @@ Returns an iterable (most likely SearchResult instance depending on list_method
...
@@ -8,18 +8,18 @@ Returns an iterable (most likely SearchResult instance depending on list_method
list_method_kwargs
=
dict
(
listbox
.
get_value
(
'default_params'
))
or
{}
list_method_kwargs
=
dict
(
listbox
.
get_value
(
'default_params'
))
or
{}
# Listbox contraints portal types
# Listbox contraints portal types
portal_types
=
listbox
.
get_value
(
'portal_types'
)
if
portal_types
is
not
None
:
if
portal_types
:
list_method_kwargs
.
update
(
portal_types
=
portal_types
)
else
:
if
"portal_type"
in
list_method_kwargs
:
if
"portal_type"
in
list_method_kwargs
:
if
isinstance
(
list_method_kwargs
[
'portal_type'
],
(
str
,
unicode
)
):
if
isinstance
(
list_method_kwargs
[
'portal_type'
],
str
):
list_method_kwargs
[
'portal_type'
]
=
[
list_method_kwargs
[
'portal_type'
],
]
list_method_kwargs
[
'portal_type'
]
=
[
list_method_kwargs
[
'portal_type'
],
]
else
:
elif
listbox
.
get_value
(
"portal_types"
):
list_method_kwargs
[
'portal_type'
]
=
[]
list_method_kwargs
[
'portal_type'
]
=
[
portal_type_name
for
portal_type_name
,
_
in
listbox
.
get_value
(
"portal_types"
)]
list_method_kwargs
[
'portal_type'
].
extend
(
portal_type_name
for
portal_type_name
,
_
in
portal_types
)
# query is provided by the caller because it is a runtime information
# query is provided by the caller because it is a runtime information
if
query
:
if
query
or
full_text
:
list_method_kwargs
.
update
(
full_text
=
query
)
# second overwrite the query
list_method_kwargs
.
update
(
full_text
=
query
or
full_text
)
# second overwrite the query
if
limit
:
if
limit
:
list_method_kwargs
.
update
(
limit
=
limit
)
list_method_kwargs
.
update
(
limit
=
limit
)
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_searchUsingListbox.xml
View file @
0e2ed43f
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
listbox, query=\'\',
sort_on=(), limit=None
</string>
</value>
<value>
<string>
listbox, query=\'\',
full_text=\'\', sort_on=(), limit=None, portal_types=None, **kwargs
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_modifyDocumentListStatus.py
View file @
0e2ed43f
...
@@ -9,6 +9,8 @@ This script is intended as a dialog target.
...
@@ -9,6 +9,8 @@ This script is intended as a dialog target.
"""
"""
from
Products.CMFCore.WorkflowCore
import
WorkflowException
from
Products.CMFCore.WorkflowCore
import
WorkflowException
MARKER
=
[]
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
request
=
kwargs
.
get
(
"REQUEST"
,
None
)
or
context
.
REQUEST
request
=
kwargs
.
get
(
"REQUEST"
,
None
)
or
context
.
REQUEST
translate
=
portal
.
Base_translateString
translate
=
portal
.
Base_translateString
...
@@ -27,7 +29,24 @@ if not workflow_action:
...
@@ -27,7 +29,24 @@ if not workflow_action:
# and we diallow submit if different action is selected and different dialog embedded
# and we diallow submit if different action is selected and different dialog embedded
request
.
form
[
'workflow_action_rendered'
]
=
workflow_action
request
.
form
[
'workflow_action_rendered'
]
=
workflow_action
if
is_updating
or
workflow_action_rendered
!=
workflow_action
:
if
kwargs
.
get
(
"update_method"
,
""
):
return
context
.
Base_renderForm
(
dialog_id
,
message
=
translate
(
"Form updated."
),
level
=
"warning"
,
REQUEST
=
request
)
if
workflow_action_rendered
!=
workflow_action
:
# if we get all fields for the workflow form - do not bother user and proceed
try
:
workflow_form_name
=
context
.
Base_getFormIdForWorkflowAction
(
form_id
,
''
,
workflow_action
,
uids
=
uids
)
workflow_form
=
getattr
(
context
,
workflow_form_name
)
# this can throw if form is not defined yet
for
group
in
workflow_form
.
get_groups
():
if
group
.
lower
()
==
'hidden'
:
continue
for
field
in
workflow_form
.
get_fields_in_group
(
group
):
if
request
.
form
.
get
(
"field_workflow_dialog_"
+
field
.
id
,
MARKER
)
is
MARKER
:
raise
AttributeError
(
"field_workflow_dialog_"
+
field
.
id
)
# direct access request.form["key"] does not throw because publisher eats the exception
except
AttributeError
:
return
context
.
Base_renderForm
(
dialog_id
,
return
context
.
Base_renderForm
(
dialog_id
,
message
=
translate
(
"Form updated."
),
message
=
translate
(
"Form updated."
),
level
=
"warning"
,
level
=
"warning"
,
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_modifyDocumentListStatus.xml
View file @
0e2ed43f
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
form_id, dialog_id, uids, workflow_action, workflow_action_rendered, comment=\'\',
is_updating=False,
**kwargs
</string>
</value>
<value>
<string>
form_id, dialog_id, uids, workflow_action, workflow_action_rendered, comment=\'\', **kwargs
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
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