From e720f3f26f243064dd83959f90d5694543053e4e Mon Sep 17 00:00:00 2001
From: Thierry Brettnacher <tb@nexedi.com>
Date: Thu, 11 Dec 2003 17:31:02 +0000
Subject: [PATCH] modification in setItemIdList : in some cases we should use
 getQuantity (on item) to compute movement quantity and in some other cases we
 should use getRemainingQuantity

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@91 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/DeliveryCell.py  | 5 ++++-
 product/ERP5/Document/DeliveryLine.py  | 5 ++++-
 product/ERP5/Document/InventoryCell.py | 4 ++--
 product/ERP5/Document/InventoryLine.py | 4 ++--
 4 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/product/ERP5/Document/DeliveryCell.py b/product/ERP5/Document/DeliveryCell.py
index ec351ab0d2..dc355f4601 100755
--- a/product/ERP5/Document/DeliveryCell.py
+++ b/product/ERP5/Document/DeliveryCell.py
@@ -275,7 +275,10 @@ Une ligne tarifaire."""
         quantity = 0
 
         for object_item in item_object_list :
-          quantity += object_item.getRemainingQuantity()
+          if self.aq_parent.aq_parent.getPortalType() in ('Purchase Packing List', ) :
+            quantity += object_item.getQuantity()
+          else :
+            quantity += object_item.getRemainingQuantity()
 
         self.setTargetQuantity(quantity)
 
diff --git a/product/ERP5/Document/DeliveryLine.py b/product/ERP5/Document/DeliveryLine.py
index a6eb3017aa..d8a8d41362 100755
--- a/product/ERP5/Document/DeliveryLine.py
+++ b/product/ERP5/Document/DeliveryLine.py
@@ -386,7 +386,10 @@ Une ligne tarifaire."""
         quantity = 0
 
         for object_item in item_object_list :
-          quantity += object_item.getRemainingQuantity()
+          if self.aq_parent.getPortalType() in ('Purchase Packing List', ) :
+            quantity += object_item.getQuantity()
+          else :
+            quantity += object_item.getRemainingQuantity()
 
         self.setTargetQuantity(quantity)
 
diff --git a/product/ERP5/Document/InventoryCell.py b/product/ERP5/Document/InventoryCell.py
index 3e79bbaf04..9b34ef7178 100755
--- a/product/ERP5/Document/InventoryCell.py
+++ b/product/ERP5/Document/InventoryCell.py
@@ -198,7 +198,7 @@ Une ligne tarifaire."""
         quantity = 0
 
         for object_item in item_object_list :
-          quantity += object_item.getRemainingQuantity()
+          quantity += object_item.getQuantity()
 
         self.setInventory(quantity)
 
@@ -272,7 +272,7 @@ Une ligne tarifaire."""
         quantity = 0
 
         for object_item in item_object_list :
-          quantity += object_item.getQuantity()
+          quantity += object_item.getRemainingQuantity()
 
         self.setConsumptionQuantity(quantity)
 
diff --git a/product/ERP5/Document/InventoryLine.py b/product/ERP5/Document/InventoryLine.py
index aa5c8a9bee..7b15b93eaf 100755
--- a/product/ERP5/Document/InventoryLine.py
+++ b/product/ERP5/Document/InventoryLine.py
@@ -238,7 +238,7 @@ Une ligne tarifaire."""
         quantity = 0
 
         for object_item in item_object_list :
-          quantity += object_item.getRemainingQuantity()
+          quantity += object_item.getQuantity()
 
         self.setInventory(quantity)
 
@@ -304,7 +304,7 @@ Une ligne tarifaire."""
         quantity = 0
 
         for object_item in item_object_list :
-          quantity += object_item.getQuantity()
+          quantity += object_item.getRemainingQuantity()
 
         self.setConsumptionQuantity(quantity)
 
-- 
2.30.9