[Erp5-report] r26863 - in /erp5/trunk: bt5/erp5_administration/PathTemplateItem/portal_alar...
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu May 7 01:14:18 CEST 2009
Author: jm
Date: Thu May 7 01:14:17 2009
New Revision: 26863
URL: http://svn.erp5.org?rev=26863&view=rev
Log:
* Move check_stock alarm from erp5_core to erp5_administration.
* Fix check_catalog and check_stock alarm to pass 'fixit' parameter.
* More unit tests to check_stock & ERP5Site_checkCatalogTable.
Added:
erp5/trunk/bt5/erp5_administration/PathTemplateItem/portal_alarms/check_stock.xml
- copied, changed from r26862, erp5/trunk/products/ERP5/bootstrap/erp5_core/PathTemplateItem/portal_alarms/check_stock.xml
Removed:
erp5/trunk/bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Alarm_activateCheckStockTable.xml
erp5/trunk/products/ERP5/bootstrap/erp5_core/PathTemplateItem/portal_alarms/check_stock.xml
Modified:
erp5/trunk/bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Alarm_checkCatalogTable.xml
erp5/trunk/bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Alarm_checkStockTable.xml
erp5/trunk/bt5/erp5_administration/bt/revision
erp5/trunk/bt5/erp5_administration/bt/template_path_list
erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision
erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/template_path_list
erp5/trunk/products/ERP5/tests/testERP5Administration.py
Copied: erp5/trunk/bt5/erp5_administration/PathTemplateItem/portal_alarms/check_stock.xml (from r26862, erp5/trunk/products/ERP5/bootstrap/erp5_core/PathTemplateItem/portal_alarms/check_stock.xml)
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_administration/PathTemplateItem/portal_alarms/check_stock.xml?p2=erp5/trunk/bt5/erp5_administration/PathTemplateItem/portal_alarms/check_stock.xml&p1=erp5/trunk/products/ERP5/bootstrap/erp5_core/PathTemplateItem/portal_alarms/check_stock.xml&r1=26862&r2=26863&rev=26863&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/PathTemplateItem/portal_alarms/check_stock.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_administration/PathTemplateItem/portal_alarms/check_stock.xml [utf8] Thu May 7 01:14:17 2009
@@ -29,7 +29,15 @@
</item>
<item>
<key> <string>active_sense_method_id</string> </key>
- <value> <string>Alarm_activateCheckStockTable</string> </value>
+ <value> <string>Alarm_checkStockTable</string> </value>
+ </item>
+ <item>
+ <key> <string>alarm_notification_mode</string> </key>
+ <value>
+ <tuple>
+ <string>problem</string>
+ </tuple>
+ </value>
</item>
<item>
<key> <string>description</string> </key>
Removed: erp5/trunk/bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Alarm_activateCheckStockTable.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Alarm_activateCheckStockTable.xml?rev=26862&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Alarm_activateCheckStockTable.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Alarm_activateCheckStockTable.xml (removed)
@@ -1,126 +1,0 @@
-<?xml version="1.0"?>
-<ZopeData>
- <record id="1" aka="AAAAAAAAAAE=">
- <pickle>
- <tuple>
- <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
- <tuple/>
- </tuple>
- </pickle>
- <pickle>
- <dictionary>
- <item>
- <key> <string>Script_magic</string> </key>
- <value> <int>3</int> </value>
- </item>
- <item>
- <key> <string>_bind_names</string> </key>
- <value>
- <object>
- <klass>
- <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
- </klass>
- <tuple/>
- <state>
- <dictionary>
- <item>
- <key> <string>_asgns</string> </key>
- <value>
- <dictionary>
- <item>
- <key> <string>name_container</string> </key>
- <value> <string>container</string> </value>
- </item>
- <item>
- <key> <string>name_context</string> </key>
- <value> <string>context</string> </value>
- </item>
- <item>
- <key> <string>name_m_self</string> </key>
- <value> <string>script</string> </value>
- </item>
- <item>
- <key> <string>name_subpath</string> </key>
- <value> <string>traverse_subpath</string> </value>
- </item>
- </dictionary>
- </value>
- </item>
- </dictionary>
- </state>
- </object>
- </value>
- </item>
- <item>
- <key> <string>_body</string> </key>
- <value> <string>active_process = context.newActiveProcess()\n
-result = context.Alarm_checkStockTable(active_process=\'/\'.join(active_process.getPhysicalPath()))\n
-active_process.postResult(result)\n
-</string> </value>
- </item>
- <item>
- <key> <string>_code</string> </key>
- <value>
- <none/>
- </value>
- </item>
- <item>
- <key> <string>_params</string> </key>
- <value> <string></string> </value>
- </item>
- <item>
- <key> <string>errors</string> </key>
- <value>
- <tuple/>
- </value>
- </item>
- <item>
- <key> <string>func_code</string> </key>
- <value>
- <object>
- <klass>
- <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
- </klass>
- <tuple/>
- <state>
- <dictionary>
- <item>
- <key> <string>co_argcount</string> </key>
- <value> <int>0</int> </value>
- </item>
- <item>
- <key> <string>co_varnames</string> </key>
- <value>
- <tuple>
- <string>_getattr_</string>
- <string>context</string>
- <string>active_process</string>
- <string>result</string>
- </tuple>
- </value>
- </item>
- </dictionary>
- </state>
- </object>
- </value>
- </item>
- <item>
- <key> <string>func_defaults</string> </key>
- <value>
- <none/>
- </value>
- </item>
- <item>
- <key> <string>id</string> </key>
- <value> <string>Alarm_activateCheckStockTable</string> </value>
- </item>
- <item>
- <key> <string>warnings</string> </key>
- <value>
- <tuple/>
- </value>
- </item>
- </dictionary>
- </pickle>
- </record>
-</ZopeData>
Modified: erp5/trunk/bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Alarm_checkCatalogTable.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Alarm_checkCatalogTable.xml?rev=26863&r1=26862&r2=26863&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Alarm_checkCatalogTable.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Alarm_checkCatalogTable.xml [utf8] Thu May 7 01:14:17 2009
@@ -53,8 +53,10 @@
</item>
<item>
<key> <string>_body</string> </key>
- <value> <string>context.ERP5Site_checkCatalogTable(\n
+ <value> <string>return context.ERP5Site_checkCatalogTable(\n
active_process=context.newActiveProcess().getPath(),\n
+ activity_count=activity_count,\n
+ bundle_object_count=bundle_object_count,\n
**kw)\n
</string> </value>
</item>
@@ -66,7 +68,7 @@
</item>
<item>
<key> <string>_params</string> </key>
- <value> <string>**kw</string> </value>
+ <value> <string>activity_count=1, bundle_object_count=100, **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
@@ -86,12 +88,14 @@
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
- <value> <int>0</int> </value>
+ <value> <int>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
+ <string>activity_count</string>
+ <string>bundle_object_count</string>
<string>kw</string>
<string>_apply_</string>
<string>_getattr_</string>
@@ -107,7 +111,10 @@
<item>
<key> <string>func_defaults</string> </key>
<value>
- <none/>
+ <tuple>
+ <int>1</int>
+ <int>100</int>
+ </tuple>
</value>
</item>
<item>
Modified: erp5/trunk/bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Alarm_checkStockTable.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Alarm_checkStockTable.xml?rev=26863&r1=26862&r2=26863&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Alarm_checkStockTable.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Alarm_checkStockTable.xml [utf8] Thu May 7 01:14:17 2009
@@ -54,11 +54,13 @@
<item>
<key> <string>_body</string> </key>
<value> <string>catalog_kw = {\'select_dict\': {\'quantity\':\'stock.quantity\'}, \'stock.quantity\': \'!=0\' }\n
-return context.ERP5Site_checkCatalogTable(bundle_object_count=bundle_object_count,\n
- bundle_offset=bundle_offset,\n
- property_override_method_id=\'ERP5Site_getStockTableFilterDict\',\n
- active_process=active_process,\n
- catalog_kw=catalog_kw)\n
+return context.ERP5Site_checkCatalogTable(\n
+ active_process=context.newActiveProcess().getPath(),\n
+ activity_count=activity_count,\n
+ bundle_object_count=bundle_object_count,\n
+ catalog_kw=catalog_kw,\n
+ property_override_method_id=\'ERP5Site_getStockTableFilterDict\',\n
+ **kw)\n
</string> </value>
</item>
<item>
@@ -69,7 +71,7 @@
</item>
<item>
<key> <string>_params</string> </key>
- <value> <string>bundle_object_count=100, bundle_offset=0, active_process=None</string> </value>
+ <value> <string>activity_count=1, bundle_object_count=100, **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
@@ -89,16 +91,17 @@
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
- <value> <int>3</int> </value>
+ <value> <int>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
+ <string>activity_count</string>
<string>bundle_object_count</string>
- <string>bundle_offset</string>
- <string>active_process</string>
+ <string>kw</string>
<string>catalog_kw</string>
+ <string>_apply_</string>
<string>_getattr_</string>
<string>context</string>
</tuple>
@@ -113,9 +116,8 @@
<key> <string>func_defaults</string> </key>
<value>
<tuple>
+ <int>1</int>
<int>100</int>
- <int>0</int>
- <none/>
</tuple>
</value>
</item>
Modified: erp5/trunk/bt5/erp5_administration/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_administration/bt/revision?rev=26863&r1=26862&r2=26863&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_administration/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_administration/bt/revision [utf8] Thu May 7 01:14:17 2009
@@ -1,1 +1,1 @@
-62
+63
Modified: erp5/trunk/bt5/erp5_administration/bt/template_path_list
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_administration/bt/template_path_list?rev=26863&r1=26862&r2=26863&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_administration/bt/template_path_list [utf8] (original)
+++ erp5/trunk/bt5/erp5_administration/bt/template_path_list [utf8] Thu May 7 01:14:17 2009
@@ -1,2 +1,3 @@
portal_alarms/check_catalog
-portal_alarms/check_folder_handler
+portal_alarms/check_folder_handler
+portal_alarms/check_stock
Removed: erp5/trunk/products/ERP5/bootstrap/erp5_core/PathTemplateItem/portal_alarms/check_stock.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/PathTemplateItem/portal_alarms/check_stock.xml?rev=26862&view=auto
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/PathTemplateItem/portal_alarms/check_stock.xml [utf8] (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/PathTemplateItem/portal_alarms/check_stock.xml (removed)
@@ -1,134 +1,0 @@
-<?xml version="1.0"?>
-<ZopeData>
- <record id="1" aka="AAAAAAAAAAE=">
- <pickle>
- <tuple>
- <global name="Alarm" module="Products.ERP5Type.Document.Alarm"/>
- <tuple/>
- </tuple>
- </pickle>
- <pickle>
- <dictionary>
- <item>
- <key> <string>_count</string> </key>
- <value>
- <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
- </value>
- </item>
- <item>
- <key> <string>_mt_index</string> </key>
- <value>
- <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
- </value>
- </item>
- <item>
- <key> <string>_tree</string> </key>
- <value>
- <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
- </value>
- </item>
- <item>
- <key> <string>active_sense_method_id</string> </key>
- <value> <string>Alarm_activateCheckStockTable</string> </value>
- </item>
- <item>
- <key> <string>description</string> </key>
- <value>
- <none/>
- </value>
- </item>
- <item>
- <key> <string>enabled</string> </key>
- <value> <int>0</int> </value>
- </item>
- <item>
- <key> <string>id</string> </key>
- <value> <string>check_stock</string> </value>
- </item>
- <item>
- <key> <string>periodicity_hour</string> </key>
- <value>
- <tuple>
- <int>3</int>
- </tuple>
- </value>
- </item>
- <item>
- <key> <string>periodicity_minute</string> </key>
- <value>
- <tuple>
- <int>1</int>
- </tuple>
- </value>
- </item>
- <item>
- <key> <string>periodicity_month</string> </key>
- <value>
- <tuple/>
- </value>
- </item>
- <item>
- <key> <string>periodicity_month_day</string> </key>
- <value>
- <tuple/>
- </value>
- </item>
- <item>
- <key> <string>periodicity_start_date</string> </key>
- <value>
- <object>
- <klass>
- <global name="DateTime" module="DateTime.DateTime"/>
- </klass>
- <tuple>
- <none/>
- </tuple>
- <state>
- <tuple>
- <float>1167606000.0</float>
- <string>GMT+1</string>
- </tuple>
- </state>
- </object>
- </value>
- </item>
- <item>
- <key> <string>periodicity_week</string> </key>
- <value>
- <tuple/>
- </value>
- </item>
- <item>
- <key> <string>portal_type</string> </key>
- <value> <string>Alarm</string> </value>
- </item>
- <item>
- <key> <string>title</string> </key>
- <value> <string>Check Stock</string> </value>
- </item>
- </dictionary>
- </pickle>
- </record>
- <record id="2" aka="AAAAAAAAAAI=">
- <pickle>
- <global name="Length" module="BTrees.Length"/>
- </pickle>
- <pickle> <int>0</int> </pickle>
- </record>
- <record id="3" aka="AAAAAAAAAAM=">
- <pickle>
- <global name="OOBTree" module="BTrees._OOBTree"/>
- </pickle>
- <pickle>
- <none/>
- </pickle>
- </record>
- <record id="4" aka="AAAAAAAAAAQ=">
- <pickle>
- <global name="OOBTree" module="BTrees._OOBTree"/>
- </pickle>
- <pickle>
- <none/>
- </pickle>
- </record>
-</ZopeData>
Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision?rev=26863&r1=26862&r2=26863&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision [utf8] (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision [utf8] Thu May 7 01:14:17 2009
@@ -1,1 +1,1 @@
-1193
+1194
Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/template_path_list
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/template_path_list?rev=26863&r1=26862&r2=26863&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/template_path_list [utf8] (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/template_path_list [utf8] Thu May 7 01:14:17 2009
@@ -1,4 +1,3 @@
-portal_alarms/check_stock
portal_alarms/expired_password_alarm
portal_caches/erp5_content_long
portal_caches/erp5_content_long/default_ram_cache
Modified: erp5/trunk/products/ERP5/tests/testERP5Administration.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testERP5Administration.py?rev=26863&r1=26862&r2=26863&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testERP5Administration.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testERP5Administration.py [utf8] Thu May 7 01:14:17 2009
@@ -28,7 +28,7 @@
##############################################################################
import unittest
-
+import transaction
from Products.ERP5.tests.testInventoryAPI import InventoryAPITestCase
class TestERP5Administration(InventoryAPITestCase):
@@ -49,21 +49,35 @@
between the predicate table and zodb objects
"""
portal = self.getPortal()
- mvt = self._makeMovement(quantity=100)
- get_transaction().commit()
+ sql_test = portal.erp5_sql_connection.manage_test
+ alarm = portal.portal_alarms.check_stock
+
+ def checkActiveProcess(failed):
+ transaction.get().commit()
+ self.tic()
+ self.assertEqual(alarm.getLastActiveProcess().ActiveProcess_sense(),
+ failed)
+ def checkStock(row_count):
+ alarm.activeSense()
+ checkActiveProcess(1)
+ alarm.solve()
+ checkActiveProcess(1)
+ alarm.activeSense()
+ checkActiveProcess(0)
+ self.assertEqual(row_count, sql_test("select count(*) from stock")[0][0])
+
+ alarm.setAlarmNotificationMode('never')
+ mvt = self._makeMovement(quantity=1.23)
+ transaction.get().commit()
self.tic()
- alarm = portal.portal_alarms.check_stock
alarm.activeSense()
- get_transaction().commit()
- self.tic()
- last_active_process = alarm.getLastActiveProcess()
- self.assertFalse(last_active_process.ActiveProcess_sense())
- portal.erp5_sql_connection.manage_test("update stock set quantity=5")
- alarm.activeSense()
- get_transaction().commit()
- self.tic()
- last_active_process = alarm.getLastActiveProcess()
- self.assertTrue(last_active_process.ActiveProcess_sense())
+ checkActiveProcess(0)
+
+ row_count = sql_test("select count(*) from stock")[0][0]
+ sql_test("update stock set quantity=5")
+ checkStock(row_count) # alarm.solve will reindex 'mvt'
+ mvt.getParentValue()._delOb(mvt.getId())
+ checkStock(row_count-2) # alarm.solve will unindex 'mvt'
def test_suite():
suite = unittest.TestSuite()
More information about the Erp5-report
mailing list