diff --git a/product/ERP5/MovementGroup.py b/product/ERP5/MovementGroup.py index d09298d22a67a550d0b681c769e315c07d5949b5..08f647efda6a88354f9361b0442bb289b50fd979 100644 --- a/product/ERP5/MovementGroup.py +++ b/product/ERP5/MovementGroup.py @@ -1068,3 +1068,26 @@ class SourceProjectMovementGroup(PropertyMovementGroup): _property = 'source_project' allow_class(SourceProjectMovementGroup) +class RequirementMovementGroup(RootMovementGroup): + """ + Group movements that have same Requirement. + """ + def getRequirementList(self,movement): + order_value = movement.getOrderValue() + requirement_list = [] + if order_value is not None: + if "Line" in order_value.getPortalType(): + requirement_list = order_value.getRequirementList() + return requirement_list + + def __init__(self,movement,**kw): + RootMovementGroup.__init__(self, movement=movement, **kw) + requirement_list = self.getRequirementList(movement) + self.requirement_list = requirement_list + self.setGroupEdit( + requirement=requirement_list + ) + + def test(self,movement): + return self.getRequirementList(movement) == self.requirement_list +