diff --git a/product/ERP5/MovementGroup.py b/product/ERP5/MovementGroup.py index ab060175d24eb370aca2dff3c5ac64bd390c71ba..d690e6efacd5f544e4d2e94799f8bde16edc60af 100644 --- a/product/ERP5/MovementGroup.py +++ b/product/ERP5/MovementGroup.py @@ -438,22 +438,17 @@ class QuantitySignMovementGroup(RootMovementGroup): def __init__(self, movement, **kw): RootMovementGroup.__init__(self, movement=movement, **kw) quantity = movement.getQuantity() - if quantity == 0: - self.sign = 0 - elif quantity > 0: - self.sign = 1 - else: - self.sign = -1 + self.sign = cmp(quantity, 0) self.setGroupEdit(quantity_sign=self.sign) def test(self, movement): quantity = movement.getQuantity() - if quantity == 0 or self.sign == 0 : + sign = cmp(quantity, 0) + if sign == 0: + return 1 + if self.sign == 0: + self.sign = sign return 1 - if quantity > 0: - sign = 1 - else: - sign = -1 return self.sign == sign allow_class(QuantitySignMovementGroup)