From c729b25fa1b2a79c62ac4ddf6a7a449ac4c5b6d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Wed, 31 Oct 2007 10:42:19 +0000 Subject: [PATCH] AccountingPeriod_init: * take into account the new workflow state name for the Accounting Period workflow. * init stop date to 31 of december by default git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17312 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../erp5_accounting/AccountingPeriod_init.xml | 33 ++++++++----------- bt5/erp5_accounting/bt/revision | 2 +- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingPeriod_init.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingPeriod_init.xml index bab3d0989c..e5226fbb96 100644 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingPeriod_init.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingPeriod_init.xml @@ -3,11 +3,8 @@ <record id="1" aka="AAAAAAAAAAE="> <pickle> <tuple> - <tuple> - <string>Products.PythonScripts.PythonScript</string> - <string>PythonScript</string> - </tuple> - <none/> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + <tuple/> </tuple> </pickle> <pickle> @@ -68,21 +65,18 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string encoding="cdata"><![CDATA[ - -portal = context.getPortalObject()\n + <value> <string>from DateTime import DateTime\n \n -period_list = context.getParentValue()\\\n - .searchFolder( simulation_state = [\'planned\', \'confirmed\', \'delivered\'],\n - sort_on = [(\'delivery.stop_date\', \'ASC\'),] )\n +period_list = context.getParentValue().searchFolder(\n + simulation_state=[\'started\', \'confirmed\', \'delivered\'],\n + sort_on=[(\'delivery.stop_date\', \'ASC\'),] )\n \n -if len(period_list) > 0 :\n +if period_list:\n last_period = period_list[-1].getObject()\n - context.setStartDate(last_period.getStopDate() + 1)\n - context.setStopDate(None) # XXX doesn\'t work\n - - -]]></string> </value> + new_date = last_period.getStopDate() + 1\n + context.setStartDate(new_date)\n + context.setStopDate(DateTime(new_date.year(), 12, 31))\n +</string> </value> </item> <item> <key> <string>_code</string> </key> @@ -126,14 +120,13 @@ if len(period_list) > 0 :\n <tuple> <string>args</string> <string>kw</string> + <string>DateTime</string> <string>_getattr_</string> <string>context</string> - <string>portal</string> <string>period_list</string> - <string>len</string> <string>_getitem_</string> <string>last_period</string> - <string>None</string> + <string>new_date</string> </tuple> </value> </item> diff --git a/bt5/erp5_accounting/bt/revision b/bt5/erp5_accounting/bt/revision index 1b6db1e863..4754f24761 100644 --- a/bt5/erp5_accounting/bt/revision +++ b/bt5/erp5_accounting/bt/revision @@ -1 +1 @@ -460 \ No newline at end of file +461 \ No newline at end of file -- 2.30.9