Commit fb401801 authored by Łukasz Nowak's avatar Łukasz Nowak

Use Person_updateOpenOrder instead of direct modification.

Also detect tag in add_kw and relock on it.
parent 12d38157
......@@ -155,7 +155,7 @@ if (request_software_instance is None):\n
stop_date = addToDate(getClosestDate(target_date=now, precision=\'month\', before=1), month=1)\n
\n
subscription_service_relative_url = portal.portal_preferences.getPreferredInstanceSubscriptionResource()\n
open_order.newContent(\n
open_order.getDestinationDecisionValue().Person_updateOpenOrder(add_kw=dict(\n
portal_type="Open Sale Order Line",\n
title=hosting_subscription.getTitle(),\n
aggregate_value=hosting_subscription,\n
......@@ -166,8 +166,8 @@ if (request_software_instance is None):\n
# XXX Hardcoded values\\n\n
resource=subscription_service_relative_url,\n
price=context.restrictedTraverse(subscription_service_relative_url).getSaleSupplyLineBasePrice(),\n
activate_kw={\'tag\': tag},\n
)\n
tag=tag\n
))\n
hosting_subscription_predecessor_list = hosting_subscription.getPredecessorList()\n
hosting_subscription_predecessor_list.append(request_software_instance.getRelativeUrl())\n
hosting_subscription.edit(predecessor_list=hosting_subscription_predecessor_list)\n
......
......@@ -81,10 +81,14 @@ if portal.portal_activities.countMessageWithTag(tag) == 0:\n
open_sale_order = previous_open_sale_order.Base_createCloneDocument(batch_mode=1)\n
open_sale_order.deleteContent(remove_id, **kw)\n
if add_kw is not None:\n
add_tag = add_kw.pop(\'tag\', None)\n
add_kw.update(kw)\n
if open_sale_order is not None:\n
open_sale_order = previous_open_sale_order.Base_createCloneDocument(batch_mode=1)\n
open_sale_order.newContent(**add_kw)\n
if add_tag is not None:\n
# lock by passed tag\n
open_sale_order.activate(tag=add_tag, after_tag=kw[\'activate_kw\'][\'tag\']).getId()\n
if stop_date is not None:\n
# check if needed to update\n
need_update = False\n
......
604
\ No newline at end of file
605
\ 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