From bec6418b7a53022388e05135114b0debaa49f838 Mon Sep 17 00:00:00 2001
From: Alain Takoudjou <alain.takoudjou@nexedi.com>
Date: Tue, 6 Sep 2016 16:18:16 +0000
Subject: [PATCH] Alarm desactivate personal computer: skip filter computer
 list by creation_date

---
 .../Alarm_checkAndUpdatePersonalComputerAllocationScope.py | 7 ++++---
 .../portal_components/test.erp5.testSlapOSCRMAlarm.py      | 2 ++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Alarm_checkAndUpdatePersonalComputerAllocationScope.py b/master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Alarm_checkAndUpdatePersonalComputerAllocationScope.py
index 71b2f3da1..dcdc65cdf 100644
--- a/master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Alarm_checkAndUpdatePersonalComputerAllocationScope.py
+++ b/master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Alarm_checkAndUpdatePersonalComputerAllocationScope.py
@@ -1,6 +1,6 @@
 from DateTime import DateTime
-from Products.ERP5Type.DateUtils import addToDate
-from Products.ZSQLCatalog.SQLCatalog import Query
+# from Products.ERP5Type.DateUtils import addToDate
+# from Products.ZSQLCatalog.SQLCatalog import Query
 
 portal = context.getPortalObject()
 
@@ -10,7 +10,8 @@ if category_personal is not None:
   portal.portal_catalog.searchAndActivate(
     portal_type='Computer',
     validation_state='validated',
-    creation_date=Query(range="max", creation_date=addToDate(DateTime(), {'day': -30})),
+    # XXX - creation_date is not indexed for computer
+    # creation_date=Query(range="max", creation_date=addToDate(DateTime(), {'day': -30})),
     default_allocation_scope_uid=category_personal.getUid(),
     method_id='Computer_checkAndUpdatePersonalAllocationScope',
     activate_kw={'tag': tag})
diff --git a/master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py b/master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
index 67fae5820..8a0e8332a 100644
--- a/master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
+++ b/master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
@@ -2,6 +2,7 @@
 import transaction
 from Products.SlapOS.tests.testSlapOSMixin import \
   testSlapOSMixin
+from unittest import skip
 from DateTime import DateTime
 from Products.ERP5Type.tests.utils import createZODBPythonScript
 
@@ -989,6 +990,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
     self.assertEqual('Visited by Computer_checkAndUpdatePersonalAllocationScope',
       self.computer.workflow_history['edit_workflow'][-1]['comment'])
 
+  @skip('computer creation date is not indexed')
   def test_alarm_allowed_allocation_scope_OpenPersonal_recent_computer(self):
     self._makeComputer()
     def getCreationDate(self):
-- 
2.30.9