From d96c55efaacbf6def62de6022cf9d89181a7bef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com> Date: Mon, 12 Mar 2012 17:16:40 +0100 Subject: [PATCH] Simplify. --- .../vifib_slap/Person_updateOpenOrder.xml | 26 ++++++------------- master/bt5/vifib_slap/bt/revision | 2 +- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Person_updateOpenOrder.xml b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Person_updateOpenOrder.xml index 88ff969a3..d05f6d892 100644 --- a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Person_updateOpenOrder.xml +++ b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Person_updateOpenOrder.xml @@ -119,31 +119,21 @@ for start_date_tuple in start_date_tuple_list:\n next_month = DateTime() + getNumberOfDayInMonth(DateTime())\n \n order = previous_open_sale_order or open_sale_order\n -need_update = False\n for line in order.contentValues(portal_type=\'Open Sale Order Line\'):\n old_stop_date = line.getStopDate()\n if old_stop_date is not None:\n if stop_date is not None and old_stop_date < stop_date:\n - need_update = True\n - break\n + if open_sale_order is None:\n + open_sale_order = previous_open_sale_order.Base_createCloneDocument(batch_mode=1)\n + line = [q for q in open_sale_order.contentValues(portal_type=\'Open Sale Order Line\') if q.getAggregate(portal_type=\'Hosting Subscription\') == line.getAggregate(portal_type=\'Hosting Subscription\')][0]\n + line.setStopDate(stop_date, activate_kw=activate_kw)\n else:\n new_stop_date = old_stop_date + getNumberOfDayInMonth(old_stop_date)\n if new_stop_date < next_month:\n - need_update = True\n - break\n -\n -if need_update:\n - if open_sale_order is None:\n - open_sale_order = previous_open_sale_order.Base_createCloneDocument(batch_mode=1)\n - for line in open_sale_order.contentValues(portal_type=\'Open Sale Order Line\'):\n - old_stop_date = line.getStopDate()\n - if old_stop_date is not None:\n - if stop_date is not None and old_stop_date < stop_date:\n - new_stop_date = stop_date\n - else:\n - new_stop_date = old_stop_date + getNumberOfDayInMonth(old_stop_date)\n - if new_stop_date < next_month:\n - line.setStopDate(new_stop_date, activate_kw=activate_kw)\n + if open_sale_order is None:\n + open_sale_order = previous_open_sale_order.Base_createCloneDocument(batch_mode=1)\n + line = [q for q in open_sale_order.contentValues(portal_type=\'Open Sale Order Line\') if q.getAggregate(portal_type=\'Hosting Subscription\') == line.getAggregate(portal_type=\'Hosting Subscription\')][0]\n + line.setStopDate(new_stop_date, activate_kw=activate_kw) \n \n for remove_hosting in remove_hosting_list:\n if remove_hosting in just_added_hosting_kw:\n diff --git a/master/bt5/vifib_slap/bt/revision b/master/bt5/vifib_slap/bt/revision index 748e6f1af..a869e998c 100644 --- a/master/bt5/vifib_slap/bt/revision +++ b/master/bt5/vifib_slap/bt/revision @@ -1 +1 @@ -637 \ No newline at end of file +638 \ No newline at end of file -- 2.30.9