Commit 96a84dd0 authored by Antoine Catton's avatar Antoine Catton

Avoid software instance to access to person object.

parent 1a363169
...@@ -86,7 +86,9 @@ if person is None:\n ...@@ -86,7 +86,9 @@ if person is None:\n
open_sale_order_line = hosting_subscription.portal_catalog.getResultValue(\n open_sale_order_line = hosting_subscription.portal_catalog.getResultValue(\n
portal_type=\'Open Sale Order Line\', strict_aggregate_uid=hosting_subscription.getUid())\n portal_type=\'Open Sale Order Line\', strict_aggregate_uid=hosting_subscription.getUid())\n
open_sale_order = open_sale_order_line.getParentValue()\n open_sale_order = open_sale_order_line.getParentValue()\n
person = open_sale_order.getDestinationSectionValue()\n person_relative_url = open_sale_order.getDestinationSection()\n
else:\n
person_relative_url = person.getRelativeUrl()\n
\n \n
new_one = False\n new_one = False\n
if (request_software_instance is None):\n if (request_software_instance is None):\n
...@@ -110,9 +112,9 @@ if (request_software_instance is None):\n ...@@ -110,9 +112,9 @@ if (request_software_instance is None):\n
\n \n
sale_order = portal.getDefaultModule(portal_type=sale_order_portal_type).newContent(\n sale_order = portal.getDefaultModule(portal_type=sale_order_portal_type).newContent(\n
portal_type=sale_order_portal_type,\n portal_type=sale_order_portal_type,\n
destination_value=person,\n destination=person_relative_url,\n
destination_section_value=person,\n destination_section=person_relative_url,\n
destination_decision_value=person,\n destination_decision=person_relative_url,\n
start_date=DateTime(),\n start_date=DateTime(),\n
received_date=DateTime(),\n received_date=DateTime(),\n
# XXX Hardcoded values\n # XXX Hardcoded values\n
...@@ -135,21 +137,22 @@ if (request_software_instance is None):\n ...@@ -135,21 +137,22 @@ if (request_software_instance is None):\n
)\n )\n
portal.portal_workflow.doActionFor(sale_order, "order_action")\n portal.portal_workflow.doActionFor(sale_order, "order_action")\n
\n \n
# Update Open Order\n if person is not None:\n
# does this order have a client-specific Open Order\n # Update Open Order\n
open_order = portal.portal_catalog.getResultValue(\n # does this order have a client-specific Open Order\n
default_destination_section_uid=person.getUid(),\n open_order = portal.portal_catalog.getResultValue(\n
portal_type="Open Sale Order",\n default_destination_section_uid=person.getUid(),\n
validation_state="validated")\n portal_type="Open Sale Order",\n
if open_order is None:\n validation_state="validated")\n
person_slap_interface_state = person.getSlapState()\n if open_order is None:\n
if person_slap_interface_state == \'open_order_created\':\n person_slap_interface_state = person.getSlapState()\n
open_order_url = context.portal_workflow.getInfoFor(\n if person_slap_interface_state == \'open_order_created\':\n
ob=person, name=\'open_order_url\',\n open_order_url = context.portal_workflow.getInfoFor(\n
wf_id=\'person_slap_interface_workflow\')\n ob=person, name=\'open_order_url\',\n
open_order = portal.restrictedTraverse(open_order_url)\n wf_id=\'person_slap_interface_workflow\')\n
else:\n open_order = portal.restrictedTraverse(open_order_url)\n
raise ValueError(\'Person has no open order created\')\n else:\n
raise ValueError(\'Person has no open order created\')\n
\n \n
now = DateTime()\n now = DateTime()\n
start_date = getClosestDate(target_date=now, precision=\'day\', before=1)\n start_date = getClosestDate(target_date=now, precision=\'day\', before=1)\n
...@@ -170,8 +173,8 @@ if (request_software_instance is None):\n ...@@ -170,8 +173,8 @@ if (request_software_instance is None):\n
specialise=sale_order.getSpecialise(portal_type="Sale Trade Condition"),\n specialise=sale_order.getSpecialise(portal_type="Sale Trade Condition"),\n
# XXX Hardcoded values\\n\n # XXX Hardcoded values\\n\n
resource=subscription_service_relative_url,\n resource=subscription_service_relative_url,\n
destination_value=person,\n destination=person_relative_url,\n
destination_section_value=person,\n destination_section=person_relative_url,\n
source="organisation_module/vifib_internet",\n source="organisation_module/vifib_internet",\n
source_section="organisation_module/vifib_internet",\n source_section="organisation_module/vifib_internet",\n
activate_kw={\'tag\': tag},\n activate_kw={\'tag\': tag},\n
......
497 498
\ 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