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
Arnaud Fontaine
erp5
Commits
c36d6150
Commit
c36d6150
authored
Oct 11, 2018
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Accessor: Generate Portal Type accessors for transitions date of Workflow History.
parent
1a02ac9c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
0 deletions
+65
-0
product/ERP5Type/Accessor/WorkflowHistory.py
product/ERP5Type/Accessor/WorkflowHistory.py
+55
-0
product/ERP5Type/Base.py
product/ERP5Type/Base.py
+10
-0
No files found.
product/ERP5Type/Accessor/WorkflowHistory.py
0 → 100644
View file @
c36d6150
##############################################################################
#
# Copyright (c) 2018 Nexedi SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from
Products.ERP5Type.PsycoWrapper
import
psyco
from
Base
import
Getter
as
BaseGetter
from
Acquisition
import
aq_base
class
Getter
(
BaseGetter
):
"""
Get a property from Workflow History. A default value can be
provided if needed.
"""
def
__init__
(
self
,
id
,
workflow_id
,
transition_id
,
key
):
self
.
_id
=
id
self
.
__name__
=
id
self
.
_workflow_id
=
workflow_id
self
.
_transition_id
=
transition_id
self
.
_key
=
key
def
__call__
(
self
,
instance
,
default
=
None
):
instance
=
aq_base
(
instance
)
try
:
workflow_history_dict_list
=
instance
.
workflow_history
[
self
.
_workflow_id
]
except
(
AttributeError
,
KeyError
):
return
default
else
:
for
workflow_history_dict
in
workflow_history_dict_list
:
if
workflow_history_dict
[
'action'
]
==
self
.
_transition_id
:
return
workflow_history_dict
.
get
(
self
.
_key
,
default
)
psyco
.
bind
(
__call__
)
product/ERP5Type/Base.py
View file @
c36d6150
...
...
@@ -481,6 +481,7 @@ def getClassPropertyList(klass):
if
p
not
in
ps_list
])
return
ps_list
from
Products.ERP5Type.Accessor.WorkflowHistory
import
Getter
as
WorkflowHistoryGetter
def
initializePortalTypeDynamicWorkflowMethods
(
ptype_klass
,
portal_workflow
):
"""We should now make sure workflow methods are defined
and also make sure simulation state is defined."""
...
...
@@ -518,6 +519,15 @@ def initializePortalTypeDynamicWorkflowMethods(ptype_klass, portal_workflow):
storage
=
dc_workflow_dict
transitions
=
wf
.
transitions
for
transition
in
transitions
.
objectValues
():
transition_id
=
transition
.
getId
()
method_id
=
'get%sTransitionDate'
%
UpperCase
(
transition_id
)
if
not
hasattr
(
ptype_klass
,
method_id
):
method
=
WorkflowHistoryGetter
(
method_id
,
wf_id
,
transition_id
,
'time'
)
ptype_klass
.
registerAccessor
(
method
,
Permissions
.
AccessContentsInformation
)
elif
wf_type
==
"InteractionWorkflowDefinition"
:
storage
=
interaction_workflow_dict
transitions
=
wf
.
interactions
...
...
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