Commit 5060228a authored by Papa Tamsir Kane's avatar Papa Tamsir Kane

erp5_decision: Remove unnecessary comments

parent eda07473
""" """
This script is called by builder after a Decision is generated by simulation. This script is called by builder after a Decision is generated by simulation.
""" """
'''
class MyException(Exception):
pass
raise MyException('ptk: got here!')
'''
portal = context.getPortalObject() portal = context.getPortalObject()
isTransitionPossible = portal.portal_workflow.isTransitionPossible isTransitionPossible = portal.portal_workflow.isTransitionPossible
decision = context decision = context
...@@ -17,14 +12,6 @@ if isTransitionPossible(decision, 'post'): ...@@ -17,14 +12,6 @@ if isTransitionPossible(decision, 'post'):
# set some meaningful title # set some meaningful title
action_type = 'Approval' action_type = 'Approval'
'''
trade_phase = decision.getTradePhase()
if trade_phase=='contract/approve/initiator':
# initial phase is called Validation
action_type = 'Validation'
elif trade_phase=='contract/approve/legal':
action_type = 'Approval'
'''
title = '%s by %s' %(action_type, source_decision_value.getTitle()) title = '%s by %s' %(action_type, source_decision_value.getTitle())
decision.setTitle(title) decision.setTitle(title)
......
""" """
List persons per division. List persons per division.
""" """
from AccessControl import getSecurityManager
source_value = context.getSourceDecisionValue() source_value = context.getSourceDecisionValue()
...@@ -10,10 +9,8 @@ source_type = source_value.getPortalType() ...@@ -10,10 +9,8 @@ source_type = source_value.getPortalType()
if source_type == 'Organisation': if source_type == 'Organisation':
organisation = source_value organisation = source_value
elif source_type == 'Person': elif source_type == 'Person':
#raise MyException('source type:' + source_type)
organisation = source_value.getCareerSubordinationValue() organisation = source_value.getCareerSubordinationValue()
else: else:
#position
organisation = source_value.getSubordinationValue() organisation = source_value.getSubordinationValue()
person_list = [] person_list = []
......
...@@ -8,7 +8,7 @@ def getPreferenceForUser(owner_id): ...@@ -8,7 +8,7 @@ def getPreferenceForUser(owner_id):
Return Preference object for user Return Preference object for user
""" """
preference_list = context.portal_preferences.searchFolder( preference_list = context.portal_preferences.searchFolder(
portal_type = 'Preference', portal_type = 'Preference',
owner = owner_id) owner = owner_id)
preference_list = [x for x in preference_list if x.getProperty('preference_state', 'broken') in ('enabled', 'global')] preference_list = [x for x in preference_list if x.getProperty('preference_state', 'broken') in ('enabled', 'global')]
if len(preference_list): if len(preference_list):
...@@ -43,5 +43,5 @@ if source_decision_value is not None: ...@@ -43,5 +43,5 @@ if source_decision_value is not None:
for reference in [x.getReference() for x in person_list]: for reference in [x.getReference() for x in person_list]:
context.portal_notifications.sendMessage( context.portal_notifications.sendMessage(
recipient=reference, recipient=reference,
subject=subject, subject=subject,
message=message) message=message)
...@@ -4,20 +4,12 @@ ...@@ -4,20 +4,12 @@
We need proxy roles as not always current approver has enough rights to change related Documents. We need proxy roles as not always current approver has enough rights to change related Documents.
""" """
portal = context.getPortalObject() portal = context.getPortalObject()
isTransitionPossible = portal.portal_workflow.isTransitionPossible
translate = portal.Base_translateString translate = portal.Base_translateString
decision = context decision = context
approval = decision.getApproval() approval = decision.getApproval()
causality_value = decision.getCausalityValue() causality_value = decision.getCausalityValue()
'''
class MyException(Exception):
pass
raise MyException(str(causality_value))
'''
if causality_value.getPortalType() in ['Curation Request Line', 'Curation Request']: if causality_value.getPortalType() in ['Curation Request Line', 'Curation Request']:
if approval: if approval:
...@@ -30,18 +22,3 @@ if causality_value.getPortalType() in ['Curation Request Line', 'Curation Reques ...@@ -30,18 +22,3 @@ if causality_value.getPortalType() in ['Curation Request Line', 'Curation Reques
portal.portal_workflow.doActionFor(causality_value, portal.portal_workflow.doActionFor(causality_value,
'invalidate_action', 'invalidate_action',
comment = translate('validation refused'), **kw) comment = translate('validation refused'), **kw)
'''
if not approval:
# cancel all other pending decisions if one is refused
other_decision_list = [x for x in causality_value.CurationRequest_getDecisionList() \
if x.getSimulationState()!='decided' and x!=decision]
for other_decision in other_decision_list:
if isTransitionPossible(other_decision, 'cancel_action'):
portal.portal_workflow.doActionFor(other_decision,
'cancel_action',
comment = translate('Canceled due to other decision rejection.'), **kw)
# invalidate the curation request
portal.portal_workflow.doActionFor(causality_value,
'invalidate_action',
comment = translate('Invalidated due to a decision rejection'), **kw)
'''
...@@ -11,6 +11,3 @@ for decision_line in decision.contentValues(filter = {'portal_type': 'Decision L ...@@ -11,6 +11,3 @@ for decision_line in decision.contentValues(filter = {'portal_type': 'Decision L
decision_line.decide() decision_line.decide()
#context.activate().Base_notifyDecisionStateChange(decision.getCausalityUid(), decision.getUid()) #context.activate().Base_notifyDecisionStateChange(decision.getCausalityUid(), decision.getUid())
# update related document for decision
# decision.Decision_updateRelatedDocument()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment