Commit eb10ad7f authored by Jérome Perrin's avatar Jérome Perrin

when creating secondary periods, create the date in their "normal" timezone.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43681 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 485495f9
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
from DateTime import DateTime\n
from Products.ERP5Type.DateUtils import addToDate\n from Products.ERP5Type.DateUtils import addToDate\n
from Products.ERP5Type.Message import translateString\n from Products.ERP5Type.Message import translateString\n
\n \n
...@@ -62,12 +63,19 @@ if frequency == \'quarterly\':\n ...@@ -62,12 +63,19 @@ if frequency == \'quarterly\':\n
date = context.getStartDate()\n date = context.getStartDate()\n
while date < context.getStopDate():\n while date < context.getStopDate():\n
end_date = addToDate(date, dict(month=month_added))\n end_date = addToDate(date, dict(month=month_added))\n
# recreate a DateTime to have it in the proper timezone\n
start_date = DateTime(date.year(), date.month(), date.day())\n
stop_date = DateTime((end_date - 1).year(),\n
(end_date - 1).month(),\n
(end_date - 1).day())\n
\n
period = context.newContent(portal_type=\'Accounting Period\',\n period = context.newContent(portal_type=\'Accounting Period\',\n
start_date=date,\n start_date=start_date,\n
stop_date=end_date - 1,)\n stop_date=stop_date)\n
\n \n
if frequency == \'quarterly\':\n if frequency == \'quarterly\':\n
period.setShortTitle(\'%s-%s\' % (date.strftime(\'%Y %m\'), (end_date - 1).strftime(\'%m\')))\n period.setShortTitle(\'%s-%s\' % (\n
date.strftime(\'%Y %m\'), (end_date - 1).strftime(\'%m\')))\n
else:\n else:\n
period.setShortTitle(date.strftime(\'%Y-%m\'))\n period.setShortTitle(date.strftime(\'%Y-%m\'))\n
period.setTitle(str(translateString(date.strftime(\'%B\'))))\n period.setTitle(str(translateString(date.strftime(\'%B\'))))\n
...@@ -77,7 +85,7 @@ while date < context.getStopDate():\n ...@@ -77,7 +85,7 @@ while date < context.getStopDate():\n
\n \n
date = end_date\n date = end_date\n
\n \n
return context.Base_redirect(form_id, \n return context.Base_redirect(form_id,\n
keep_items=dict(portal_status_message=translateString(\'Accounting periods created.\')))\n keep_items=dict(portal_status_message=translateString(\'Accounting periods created.\')))\n
......
1453 1454
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment