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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
c61314bd
Commit
c61314bd
authored
Oct 31, 2011
by
Leonardo Rochael Almeida
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Really unlink simulation expansion from Business Process
Don't even search for future trade phases.
parent
fc873925
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
54 deletions
+3
-54
product/ERP5/Document/SimulationMovement.py
product/ERP5/Document/SimulationMovement.py
+3
-54
No files found.
product/ERP5/Document/SimulationMovement.py
View file @
c61314bd
...
@@ -284,68 +284,17 @@ class SimulationMovement(PropertyRecordableMixin, Movement, ExplainableMixin):
...
@@ -284,68 +284,17 @@ class SimulationMovement(PropertyRecordableMixin, Movement, ExplainableMixin):
tv
[
key
]
=
None
# disallow further calls to 'calculate'
tv
[
key
]
=
None
# disallow further calls to 'calculate'
transaction
.
get
().
addBeforeCommitHook
(
before_commit
)
transaction
.
get
().
addBeforeCommitHook
(
before_commit
)
security
.
declarePrivate
(
'_getSuccessorTradePhaseList'
)
def
_getSuccessorTradePhaseList
(
self
):
"""
Get the list of future trade_phase categories from this simulation
movement according to the related business process
"""
# XXX-Leo this method could be smaller if (one or more of):
# * Simulation Movements had trade_state instead of trade_phase categories,
# * .asComposedDocument() also included the causality Business Link,
# * BusinessLink objects had a '.getSucessorTradePhaseList' method (accepting
# a context parameter for predicate checking).
# * .getBusinessLinkValueList() accepted a predecessor_link parameter,
# * some of the work below was done by a Business Process method,
portal
=
self
.
getPortalObject
()
business_process
=
self
.
asComposedDocument
()
business_link_type_list
=
portal
.
getPortalBusinessLinkTypeList
()
business_link
=
self
.
getCausalityValue
(
portal_type
=
business_link_type_list
)
if
business_link
is
None
:
# XXX-Leo we could just return self.getTradePhaseList() for
# backward compatibility
from
Products.ERP5Type.Errors
import
SimulationError
raise
SimulationError
(
'No Business Link Causality for %r. Cannot enumerate successor trade_phases.'
%
(
self
,))
# from this Business Process, get the Business Links which
# predecessor state match the successor state of our Business Link
# causality
successor_trade_state
=
business_link
.
getSuccessor
()
successor_link_list
=
business_process
.
getBusinessLinkValueList
(
context
=
self
,
predecessor
=
successor_trade_state
)
successor_trade_phase_list
=
[
link
.
getTradePhase
()
for
link
in
successor_link_list
]
return
successor_trade_phase_list
security
.
declarePrivate
(
'_asSuccessorContext'
)
def
_asSuccessorContext
(
self
):
""" Returns a version of self with future trade phases
"""
successor_trade_phase_list
=
self
.
_getSuccessorTradePhaseList
()
context
=
self
.
asContext
()
context
.
edit
(
trade_phase_list
=
successor_trade_phase_list
)
return
context
security
.
declarePrivate
(
'_getApplicableRuleList'
)
security
.
declarePrivate
(
'_getApplicableRuleList'
)
def
_getApplicableRuleList
(
self
):
def
_getApplicableRuleList
(
self
):
""" Search rules that match this movement
""" Search rules that match this movement
"""
"""
successor_trade_phase_list
=
self
.
_getSuccessorTradePhaseList
()
portal_rules
=
self
.
getPortalObject
().
portal_rules
portal_rules
=
self
.
getPortalObject
().
portal_rules
# XXX-Leo: According to JP, the 'version' search below is wrong and
# XXX-Leo: According to JP, the 'version' search below is wrong and
# should be replaced by a check that there are not two rules with the
# should be replaced by a check that there are not two rules with the
# same reference that can be returned.
# same reference that can be returned.
return
portal_rules
.
searchRuleList
(
return
portal_rules
.
searchRuleList
(
self
,
self
,
sort_on
=
'version'
,
# XXX-Leo: Fugly catalog syntax for category search. We should
sort_order
=
'descending'
)
# fix the catalog to accept just 'trade_phase' for the keyword,
# and not to require prefixing the values with 'trade_phase/' again:
trade_phase_relative_url
=
[
'trade_phase/'
+
path
for
path
in
successor_trade_phase_list
],
sort_on
=
'version'
,
sort_order
=
'descending'
)
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'expand'
)
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'expand'
)
def
expand
(
self
,
**
kw
):
def
expand
(
self
,
**
kw
):
...
...
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