Commit 038c317e authored by Łukasz Nowak's avatar Łukasz Nowak

- remove Open Sale Order Line in external proxy role script

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44889 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6922bd8f
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string># As Open Sale Order codebase is unstable Assignor proxied role script is introduced\n
# to cleanup finialised Open Sale Order Line\n
\n
if REQUEST is not None:\n
# protect against direct HTTP access, XML-RPC will still work\n
raise ValueError(\'Not available\')\n
from Products.ZSQLCatalog.SQLCatalog import NegatedQuery, Query\n
\n
portal = context.getPortalObject()\n
all_delivered = True\n
for sale_packing_list_line in portal.portal_catalog(\n
portal_type="Sale Packing List Line", \n
default_aggregate_uid=context.getUid(),\n
simulation_state=NegatedQuery(Query(simulation_state="delivered")),\n
):\n
if sale_packing_list_line.getSimulationState() != \'delivered\':\n
all_delivered = False\n
if all_delivered:\n
open_order_line = context.getAggregateRelatedValue(portal_type="Open Sale Order Line")\n
if open_order_line is not None:\n
# XXX: Mahybe system shall *NOT* work without Open Sale Orders\n
open_order_line.getParentValue().manage_delObjects(open_order_line.getId())\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>REQUEST=None</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Assignor</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>HostingSubscription_removeRelatedOpenSaleOrderLine</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -89,19 +89,7 @@ for sale_packing_list_line in portal.portal_catalog(\n
raise ValueError(\'It was not possible to deliver %r during destruction of %r\' (sale_packing_list.getRelativeUrl(), software_instance.getRelativeUrl()))\n
# Remove unused open sale order line\n
subscription_item = sale_packing_list_line.getAggregateValue(portal_type="Hosting Subscription")\n
all_delivered = True\n
for sale_packing_list_line in portal.portal_catalog(\n
portal_type="Sale Packing List Line", \n
default_aggregate_uid=subscription_item.getUid(),\n
simulation_state=NegatedQuery(Query(simulation_state="delivered")),\n
):\n
if sale_packing_list_line.getSimulationState() != \'delivered\':\n
all_delivered = False\n
if all_delivered:\n
open_order_line = subscription_item.getAggregateRelatedValue(portal_type="Open Sale Order Line")\n
if open_order_line is not None:\n
# XXX: Mahybe system shall *NOT* work without Open Sale Orders\n
open_order_line.getParentValue().manage_delObjects(open_order_line.getId())\n
subscription_item.HostingSubscription_removeRelatedOpenSaleOrderLine()\n
</string> </value>
</item>
<item>
......
367
\ No newline at end of file
368
\ 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