From a2f5df2326403de8f677d808ec58dcaf5fcd95a9 Mon Sep 17 00:00:00 2001
From: Tatuya Kamada <tatuya@nexedi.com>
Date: Fri, 12 Mar 2010 08:52:36 +0000
Subject: [PATCH] Fix the issue that when the sign of a quantity is negative,
 getAveragePrice method returns always 0.0. It will cause a problem, for
 example in an accounting transaction line. (approved by kazuhiko)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33687 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/MovementGroup.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/product/ERP5/MovementGroup.py b/product/ERP5/MovementGroup.py
index 0c6ac64587..1d59047681 100644
--- a/product/ERP5/MovementGroup.py
+++ b/product/ERP5/MovementGroup.py
@@ -398,7 +398,7 @@ class FakeMovement:
       Return average price
     """
     total_quantity = self.getAddQuantity()
-    if total_quantity > 0:
+    if total_quantity != 0:
       return (self.getAddPrice() / total_quantity)
     return 0.0
 
-- 
2.30.9