Commit 25aea6a2 authored by Romain Courteaud's avatar Romain Courteaud

Added new MovementGroups.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6351 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5d71d6cf
......@@ -39,6 +39,7 @@ from Products.PythonScripts.Utility import allow_class
class MovementRejected(Exception) : pass
class FakeMovementError(Exception) : pass
class MovementGroupError(Exception) : pass
class RootMovementGroup:
......@@ -116,6 +117,12 @@ class RootMovementGroup:
"""
self._property_dict = kw
def updateGroupEdit(self, **kw):
"""
Update properties for the futur created object
"""
self._property_dict.update(kw)
def getGroupEditDict(self):
"""
Get property dict for the futur created object
......@@ -1001,3 +1008,44 @@ class SplitMovementGroup(RootMovementGroup):
return 0
allow_class(AggregateMovementGroup)
class TransformationAppliedRuleCausalityMovementGroup(RootMovementGroup):
"""
Groups movement that comes from simulation movement that shares the
same Production Applied Rule.
"""
def __init__(self, movement, **kw):
RootMovementGroup.__init__(self, movement=movement, **kw)
explanation_relative_url = self._getExplanationRelativeUrl(movement)
self.explanation = explanation_relative_url
explanation_value = movement.getPortalObject().restrictedTraverse(
explanation_relative_url)
self.setGroupEdit(causality_value=explanation_value)
def _getExplanationRelativeUrl(self, movement):
""" Get the order value for a movement """
transformation_applied_rule = movement.getParent()
transformation_rule = transformation_applied_rule.getSpecialiseValue()
if transformation_rule.getPortalType() != 'Transformation Rule':
raise MovementGroupError, 'movement! %s' % movement.getPath()
# XXX Dirty hardcoded
production_movement = transformation_applied_rule.pr
production_packing_list = production_movement.getExplanationValue()
return production_packing_list.getRelativeUrl()
def test(self,movement):
return self._getExplanationRelativeUrl(movement) == self.explanation
allow_class(TransformationAppliedRuleCausalityMovementGroup)
class ParentExplanationCausalityMovementGroup(ParentExplanationMovementGroup):
"""
Like ParentExplanationMovementGroup, and set the causality.
"""
def __init__(self, movement, **kw):
ParentExplanationMovementGroup.__init__(self, movement=movement, **kw)
self.updateGroupEdit(
causality_value = self.explanation_value
)
allow_class(ParentExplanationCausalityMovementGroup)
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