Commit cdf1f9fb authored by Guillaume Michon's avatar Guillaume Michon

Modified PathMovementGroup behavior

Added 2 MovementGroups


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3333 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f02973d0
......@@ -243,23 +243,23 @@ class PathMovementGroup(RootMovementGroup):
#LOG('PathGroup.__init__ source',0,self.source)
self.destination = movement.getDestination()
#LOG('PathGroup.__init__ destination',0,self.destination)
self.source_section = movement.getSourceSection()
#self.source_section = movement.getSourceSection()
#LOG('PathGroup.__init__ source_section',0,self.source_section)
self.destination_section = movement.getDestinationSection()
#self.destination_section = movement.getDestinationSection()
#LOG('PathGroup.__init__ destination_section',0,self.destination_section)
self.setGroupEdit(
source_value=movement.getSourceValue(),
destination_value=movement.getDestinationValue(),
source_section_value=movement.getSourceSectionValue(),
destination_section_value=movement.getDestinationSectionValue(),
#source_section_value=movement.getSourceSectionValue(),
#destination_section_value=movement.getDestinationSectionValue(),
)
def test(self,movement):
if movement.getSource() == self.source and \
movement.getDestination() == self.destination and \
movement.getSourceSection() == self.source_section and \
movement.getDestinationSection() == self.destination_section :
movement.getDestination() == self.destination:
#movement.getSourceSection() == self.source_section and \
#movement.getDestinationSection() == self.destination_section :
return 1
else :
......@@ -267,6 +267,47 @@ class PathMovementGroup(RootMovementGroup):
allow_class(PathMovementGroup)
class SectionPathMovementGroup(RootMovementGroup):
def __init__(self,movement,**kw):
RootMovementGroup.__init__(self, movement=movement, **kw)
self.source_section = movement.getSourceSection()
self.destination_section = movement.getDestinationSection()
self.setGroupEdit(
source_section = movement.getSourceSection(),
destination_section = movement.getDestinationSection(),
)
def test(self, movement):
if movement.getSourceSection() == self.source_section and \
movement.getDestinationSection() == self.destination_section:
return 1
return 0
allow_class(SectionPathMovementGroup)
# XXX Naming issue ?
class QuantitySignMovementGroup(RootMovementGroup):
def __init__(self, movement, **kw):
RootMovementGroup.__init__(self, movement=movement, **kw)
quantity = movement.getQuantity()
if quantity >= 0:
self.sign = 1
else:
self.sign = -1
self.setGroupEdit(quantity_sign=self.sign)
def test(self, movement):
quantity = movement.getQuantity()
if quantity >= 0:
sign = 1
else:
sign = -1
if self.sign == sign:
return 1
return 0
allow_class(QuantitySignMovementGroup)
class DateMovementGroup(RootMovementGroup):
def __init__(self,movement,**kw):
......
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