From 085c4f47d075b60ac621565fbcbe6c78fd38645a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Fri, 16 Sep 2005 08:37:46 +0000
Subject: [PATCH] QuantitySignMovementGroup must group 0 quantity with both
 positive and negative quantities

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3795 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/MovementGroup.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/product/ERP5/MovementGroup.py b/product/ERP5/MovementGroup.py
index 9292e71ca4..5aec7d0f57 100755
--- a/product/ERP5/MovementGroup.py
+++ b/product/ERP5/MovementGroup.py
@@ -308,7 +308,9 @@ class QuantitySignMovementGroup(RootMovementGroup):
   def __init__(self, movement, **kw):
     RootMovementGroup.__init__(self, movement=movement, **kw)
     quantity = movement.getQuantity()
-    if quantity >= 0:
+    if quantity == 0:
+      self.sign = 0
+    elif quantity > 0:
       self.sign = 1
     else:
       self.sign = -1
@@ -316,13 +318,13 @@ class QuantitySignMovementGroup(RootMovementGroup):
 
   def test(self, movement):
     quantity = movement.getQuantity()
-    if quantity >= 0:
+    if quantity == 0 or self.sign == 0 :
+      return 1
+    if quantity > 0:
       sign = 1
     else:
       sign = -1
-    if self.sign == sign:
-      return 1
-    return 0
+    return self.sign == sign
 
 allow_class(QuantitySignMovementGroup)
 
-- 
2.30.9