Commit d9e5b98a authored by Łukasz Nowak's avatar Łukasz Nowak

- naming convention fix: do not use abbreviations, be explicit in what method returns

 - put method to non overloadable group


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28253 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f1c1e7ce
...@@ -82,7 +82,7 @@ class BPMInvoiceTransactionRule(BPMRule, PredicateMatrix): ...@@ -82,7 +82,7 @@ class BPMInvoiceTransactionRule(BPMRule, PredicateMatrix):
These previsions are actually returned as dictionaries. These previsions are actually returned as dictionaries.
""" """
input_movement, business_path = self._getInputMovementAndPathList( input_movement, business_path = self._getInputMovementAndPathTupleList(
applied_rule)[0] applied_rule)[0]
prevision_list = [] prevision_list = []
......
...@@ -115,29 +115,29 @@ class BPMRule(Predicate, XMLObject): ...@@ -115,29 +115,29 @@ class BPMRule(Predicate, XMLObject):
# Solvers # Solvers
security.declareProtected( Permissions.AccessContentsInformation, security.declareProtected( Permissions.AccessContentsInformation,
'isDivergent') 'isDivergent')
def isDivergent(self, sim_mvt, ignore_list=[]): def isDivergent(self, simulation_movement, ignore_list=[]):
""" """
Returns true if the Simulation Movement is divergent comparing to Returns true if the Simulation Movement is divergent comparing to
the delivery value the delivery value
""" """
delivery = sim_mvt.getDeliveryValue() delivery = simulation_movement.getDeliveryValue()
if delivery is None: if delivery is None:
return 0 return 0
if self.getDivergenceList(sim_mvt) == []: if self.getDivergenceList(simulation_movement) == []:
return 0 return 0
else: else:
return 1 return 1
security.declareProtected(Permissions.View, 'getDivergenceList') security.declareProtected(Permissions.View, 'getDivergenceList')
def getDivergenceList(self, sim_mvt): def getDivergenceList(self, simulation_movement):
""" """
Return a list of messages that contains the divergences. Return a list of messages that contains the divergences.
""" """
result_list = [] result_list = []
for divergence_tester in self.contentValues( for divergence_tester in self.contentValues(
portal_type=self.getPortalDivergenceTesterTypeList()): portal_type=self.getPortalDivergenceTesterTypeList()):
result = divergence_tester.explain(sim_mvt) result = divergence_tester.explain(simulation_movement)
result_list.extend(result) result_list.extend(result)
return result_list return result_list
...@@ -173,25 +173,6 @@ class BPMRule(Predicate, XMLObject): ...@@ -173,25 +173,6 @@ class BPMRule(Predicate, XMLObject):
This method might be overloaded""" This method might be overloaded"""
return [applied_rule.getParentValue()] return [applied_rule.getParentValue()]
def _getInputMovementAndPathList(self, applied_rule):
input_movement_list = self._getInputMovementList(applied_rule)
business_process = applied_rule.getBusinessProcessValue()
input_movement_and_path_list = []
business_path_list = []
for input_movement in input_movement_list:
for business_path in business_process.getPathValueList(
self.getTradePhaseList(),
input_movement):
input_movement_and_path_list.append((input_movement, business_path))
business_path not in business_path_list and business_path_list \
.append(business_path)
if len(business_path_list) > 1:
raise NotImplementedError
return input_movement_and_path_list
def _generatePrevisionList(self, applied_rule, **kw): def _generatePrevisionList(self, applied_rule, **kw):
""" """
Generate a list of dictionaries, that contain calculated content of Generate a list of dictionaries, that contain calculated content of
...@@ -201,7 +182,8 @@ class BPMRule(Predicate, XMLObject): ...@@ -201,7 +182,8 @@ class BPMRule(Predicate, XMLObject):
These previsions are returned as dictionaries. These previsions are returned as dictionaries.
""" """
prevision_dict_list = [] prevision_dict_list = []
for input_movement, business_path in self._getInputMovementAndPathList(applied_rule): for input_movement, business_path in self \
._getInputMovementAndPathTupleList(applied_rule):
prevision_dict_list.append(self._getExpandablePropertyDict(applied_rule, prevision_dict_list.append(self._getExpandablePropertyDict(applied_rule,
input_movement, business_path)) input_movement, business_path))
return prevision_dict_list return prevision_dict_list
...@@ -235,6 +217,26 @@ class BPMRule(Predicate, XMLObject): ...@@ -235,6 +217,26 @@ class BPMRule(Predicate, XMLObject):
return (immutable_movement_list, mutable_movement_list, return (immutable_movement_list, mutable_movement_list,
deletable_movement_list) deletable_movement_list)
def _getInputMovementAndPathTupleList(self, applied_rule):
"""Returns list of tuples (movement, business_path)"""
input_movement_list = self._getInputMovementList(applied_rule)
business_process = applied_rule.getBusinessProcessValue()
input_movement_and_path_list = []
business_path_list = []
for input_movement in input_movement_list:
for business_path in business_process.getPathValueList(
self.getTradePhaseList(),
input_movement):
input_movement_and_path_list.append((input_movement, business_path))
business_path not in business_path_list and business_path_list \
.append(business_path)
if len(business_path_list) > 1:
raise NotImplementedError
return input_movement_and_path_list
def _getCompensatedMovementList(self, applied_rule, **kw): def _getCompensatedMovementList(self, applied_rule, **kw):
""" """
Compute the difference between prevision and existing movements Compute the difference between prevision and existing movements
......
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