Commit 26e12abc authored by Łukasz Nowak's avatar Łukasz Nowak

- create new helper method to fetch input movements with business path

 - use this method in BPMInvoiceTransactionRule to avoid code repetition
 - set property_sheets explicitly on each class (inheritance for property_sheet property is not working?)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28249 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a6bb0ffa
......@@ -44,6 +44,8 @@ class BPMDeliveryRule(BPMRule):
meta_type = 'ERP5 BPM Delivery Rule'
portal_type = 'BPM Delivery Rule'
property_sheets = BPMRule.property_sheets
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
......
......@@ -43,23 +43,13 @@ class BPMInvoiceTransactionRule(BPMRule, PredicateMatrix):
# CMF Type Definition
meta_type = 'ERP5 BPM Invoice Transaction Rule'
portal_type = 'BPM Invoice Transaction Rule'
add_permission = Permissions.AddPortalContent
isPortalContent = 1
isRADContent = 1
property_sheets = BPMRule.property_sheets
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
, PropertySheet.AppliedRule
)
def _getCurrencyRatioByArrow(self, arrow, prevision_line):
from Products.ERP5Type.Document import newTempSimulationMovement
temporary_movement = newTempSimulationMovement(self.getPortalObject(),
......@@ -92,19 +82,9 @@ class BPMInvoiceTransactionRule(BPMRule, PredicateMatrix):
These previsions are actually returned as dictionaries.
"""
input_movement, business_path = self._getInputMovementAndPathList(
applied_rule)[0]
prevision_list = []
input_movement = applied_rule.getParentValue()
business_process = applied_rule.getBusinessProcessValue()
movement_and_path_list = []
for business_path in business_process.getPathValueList(
self.getProperty('trade_phase_list'),
input_movement):
movement_and_path_list.append((input_movement, business_path))
if len(movement_and_path_list) > 1:
raise NotImplementedError
# Find a matching cell
cell = self._getMatchingCell(input_movement)
......
......@@ -45,6 +45,8 @@ class BPMInvoicingRule(BPMRule):
meta_type = 'ERP5 BPM Invoicing Rule'
portal_type = 'BPM Invoicing Rule'
property_sheets = BPMRule.property_sheets
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
......
......@@ -43,6 +43,8 @@ class BPMOrderRule(BPMDeliveryRule):
meta_type = 'ERP5 BPM Order Rule'
portal_type = 'BPM Order Rule'
property_sheets = BPMRule.property_sheets
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
......
......@@ -173,14 +173,7 @@ class BPMRule(Predicate, XMLObject):
This method might be overloaded"""
return [applied_rule.getParentValue()]
def _generatePrevisionList(self, applied_rule, **kw):
"""
Generate a list of dictionaries, that contain calculated content of
current Simulation Movements in applied rule.
based on its context (parent movement, delivery, configuration ...)
These previsions are returned as dictionaries.
"""
def _getInputMovementAndPathList(self, applied_rule):
input_movement_list = self._getInputMovementList(applied_rule)
business_process = applied_rule.getBusinessProcessValue()
......@@ -197,8 +190,18 @@ class BPMRule(Predicate, XMLObject):
if len(business_path_list) > 1:
raise NotImplementedError
return input_movement_and_path_list
def _generatePrevisionList(self, applied_rule, **kw):
"""
Generate a list of dictionaries, that contain calculated content of
current Simulation Movements in applied rule.
based on its context (parent movement, delivery, configuration ...)
These previsions are returned as dictionaries.
"""
prevision_dict_list = []
for input_movement, business_path in input_movement_and_path_list:
for input_movement, business_path in self._getInputMovementAndPathList(applied_rule):
prevision_dict_list.append(self._getExpandablePropertyDict(applied_rule,
input_movement, business_path))
return prevision_dict_list
......
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