Commit bf5b8244 authored by Jérome Perrin's avatar Jérome Perrin

Added SourceMovementGroup and DestinationMovementGroup


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7265 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 66e40917
...@@ -1020,3 +1020,35 @@ class ParentExplanationCausalityMovementGroup(ParentExplanationMovementGroup): ...@@ -1020,3 +1020,35 @@ class ParentExplanationCausalityMovementGroup(ParentExplanationMovementGroup):
) )
allow_class(ParentExplanationCausalityMovementGroup) allow_class(ParentExplanationCausalityMovementGroup)
class PropertyMovementGroup(RootMovementGroup):
"""Abstract movement group for movement that share the same value for
a property.
"""
_property = [] # Subclasses must override this
def __init__(self, movement, **kw):
RootMovementGroup.__init__(self, movement=movement, **kw)
if self._property is PropertyMovementGroup._property :
raise ValueError, 'PropertyMovementGroup: property not defined'
assert isinstance(self._property, str)
prop_value = movement.getProperty(self._property)
self._property_dict = { self._property : prop_value }
self.setGroupEdit(
**self._property_dict
)
def test(self, movement) :
return self._property_dict[self._property] == \
movement.getProperty(self._property)
class SourceMovementGroup(PropertyMovementGroup):
"""Group movements having the same source."""
_property = 'source'
allow_class(SourceMovementGroup)
class DestinationMovementGroup(PropertyMovementGroup):
"""Group movements having the same destination."""
_property = 'destination'
allow_class(DestinationMovementGroup)
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