From a117ffc85271ab314665aa31eaef51add6e427be Mon Sep 17 00:00:00 2001
From: Jean-Paul Smets <jp@nexedi.com>
Date: Thu, 21 May 2009 15:12:13 +0000
Subject: [PATCH] Take into account installation state. This is a quick and
 dirty fix. It would be better to allow users for example to select the latest
 bt5 in a given state.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27088 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../ERP5SiteDocumentationHelper.py                  | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/product/ERP5Type/DocumentationHelper/ERP5SiteDocumentationHelper.py b/product/ERP5Type/DocumentationHelper/ERP5SiteDocumentationHelper.py
index 2800c558f9..c5098708d0 100644
--- a/product/ERP5Type/DocumentationHelper/ERP5SiteDocumentationHelper.py
+++ b/product/ERP5Type/DocumentationHelper/ERP5SiteDocumentationHelper.py
@@ -56,9 +56,16 @@ class ERP5SiteDocumentationHelper(DocumentationHelper):
     return "ERP5 Site"
 
   def getBusinessTemplateValueList(self):
-    bt_list = getattr(self, 'REQUEST', {}).get("business_template_list")
-    return (bt for bt in self.getPortalObject().portal_templates.objectValues()
-               if bt_list is None or bt.getTitle() in bt_list)
+    documented_bt_list = getattr(self, 'REQUEST', {}).get("business_template_list")
+#    return (bt for bt in self.getPortalObject().portal_templates.objectValues()
+#               if bt_list is None or (bt.getTitle() in bt_list and bt.getInstallationSate()=='installed'))
+
+    bt_list = []
+    for bt in self.getDocumentedObject().portal_templates.objectValues():
+      if bt.getInstallationState() == 'installed' and (documented_bt_list is None or bt.getTitle() in documented_bt_list):
+        bt_list.append(bt)
+    return bt_list
+
 
   security.declareProtected(Permissions.AccessContentsInformation, 'getBusinessTemplateItemList')
   def getBusinessTemplateItemList(self):
-- 
2.30.9