Commit 4fc387f4 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

define Rule class in NewOrderRule.py temporarily, that will be a super class...

define Rule class in NewOrderRule.py temporarily, that will be a super class of any rule in the new simulation implementation.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31337 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f5bbe1dc
......@@ -38,17 +38,9 @@ from Products.ERP5.mixin.movement_collection_updater import \
MovementCollectionUpdaterMixin
from Products.ERP5.MovementCollectionDiff import _getPropertyAndCategoryList
class NewOrderRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate):
"""
Order Rule object make sure an Order in the simulation
is consistent with the real order
WARNING: what to do with movement split ?
"""
# CMF Type Definition
meta_type = 'ERP5 New Order Rule'
portal_type = 'New Order Rule'
# XXX this class should be moved to Rule.py once new simulation is fully
# integrated.
class Rule(RuleMixin, MovementCollectionUpdaterMixin, Predicate):
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
......@@ -71,6 +63,38 @@ class NewOrderRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate):
PropertySheet.Rule
)
security.declareProtected(Permissions.View, 'getDivergenceList')
def getDivergenceList(self, movement):
"""
Returns a list of divergences of the movements provided
in delivery_or_movement.
movement -- a movement, a delivery, a simulation movement,
or a list thereof
"""
if movement.getDelivery() is None:
return []
result_list = []
for divergence_tester in self._getDivergenceTesterList(
exclude_quantity=False):
result = divergence_tester.explain(movement)
if isinstance(result, (list, tuple)): # for compatibility
result_list.extend(result)
elif result is not None:
result_list.append(result)
return result_list
class NewOrderRule(Rule):
"""
Order Rule object make sure an Order in the simulation
is consistent with the real order
WARNING: what to do with movement split ?
"""
# CMF Type Definition
meta_type = 'ERP5 New Order Rule'
portal_type = 'New Order Rule'
# XXX this method is missing in interface.
def isOrderable(self, movement):
return 1
......
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