From 92ed4806d43d44dfa1aa81982c7f878b512323ed Mon Sep 17 00:00:00 2001
From: Jean-Paul Smets <jp@nexedi.com>
Date: Sun, 2 May 2004 19:28:51 +0000
Subject: [PATCH] Improved state selection in inventory methods

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@793 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/Resource.py | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/product/ERP5/Document/Resource.py b/product/ERP5/Document/Resource.py
index 5cdfa15eca..8ab3f4e9e5 100755
--- a/product/ERP5/Document/Resource.py
+++ b/product/ERP5/Document/Resource.py
@@ -35,7 +35,7 @@ from Products.ERP5Type.XMLObject import XMLObject
 
 from Products.ERP5.Variated import Variated
 from Products.ERP5.Core.Resource import Resource as CoreResource
-from Products.ERP5.ERP5Globals import resource_type_list, variation_type_list, default_section_category, current_inventory_state_list
+from Products.ERP5.ERP5Globals import resource_type_list, variation_type_list, default_section_category, current_inventory_state_list, future_inventory_state_list, reserved_inventory_state_list
 
 from zLOG import LOG
 
@@ -244,7 +244,10 @@ a service in a public administration)."""
         Returns inventory at infinite
       """
       return self.getInventory(at_date=None, section=section, node=node,
-                             node_category=node_category, section_category=section_category, **kw)
+        node_category=node_category, section_category=section_category,
+                        simulation_state=list(future_inventory_state_list)+ \
+                        list(reserved_inventory_state_list)+list(current_inventory_state_list),
+                        **kw)
 
     security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventory')
     def getCurrentInventory(self, section = None, node = None,
@@ -291,14 +294,16 @@ a service in a public administration)."""
 
     security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventoryList')
     def getFutureInventoryList(self, section = None, node = None,
-             node_category=None, section_category=default_section_category, simulation_state=None,
-             ignore_variation=0, **kw):
+             node_category=None, section_category=default_section_category,
+             simulation_state=None, ignore_variation=0, **kw):
       """
         Returns list of future inventory grouped by section or site
       """
       LOG('getFutureInventoryList',0,str(kw))
       return self.getInventoryList(at_date=None, section=section, node=node,
-                             node_category=node_category, section_category=section_category, **kw)
+                             node_category=node_category, section_category=section_category,
+                             simulation_state=list(future_inventory_state_list)+ \
+                        list(reserved_inventory_state_list)+list(current_inventory_state_list), **kw)
 
     security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventoryList')
     def getCurrentInventoryList(self, section = None, node = None,
@@ -333,13 +338,15 @@ a service in a public administration)."""
 
     security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventoryStat')
     def getFutureInventoryStat(self, section = None, node = None,
-             node_category=None, section_category=default_section_category, simulation_state=None,
-             ignore_variation=0, **kw):
+             node_category=None, section_category=default_section_category,
+             simulation_state=None, ignore_variation=0, **kw):
       """
         Returns statistics of future inventory list grouped by section or site
       """
       return self.getInventoryStat(at_date=None, section=section, node=node,
-                             node_category=node_category, section_category=section_category, **kw)
+                             node_category=node_category, section_category=section_category,
+                             simulation_state=list(future_inventory_state_list)+ \
+                        list(reserved_inventory_state_list)+list(current_inventory_state_list), **kw)
 
     security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventoryStat')
     def getCurrentInventoryStat(self, section = None, node = None,
@@ -372,13 +379,15 @@ a service in a public administration)."""
 
     security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventoryChart')
     def getFutureInventoryChart(self, section = None, node = None,
-             node_category=None, section_category=default_section_category, simulation_state=None,
-             ignore_variation=0, **kw):
+             node_category=None, section_category=default_section_category,
+             simulation_state=None, ignore_variation=0, **kw):
       """
         Returns list of future inventory grouped by section or site
       """
       return self.getInventoryChart(at_date=None, section=section, node=node,
-                             node_category=node_category, section_category=section_category, **kw)
+                             node_category=node_category, section_category=section_category,
+                             simulation_state=list(future_inventory_state_list)+ \
+                        list(reserved_inventory_state_list)+list(current_inventory_state_list), **kw)
 
     security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventoryChart')
     def getCurrentInventoryChart(self, section = None, node = None,
-- 
2.30.9