Commit 599912f1 authored by Łukasz Nowak's avatar Łukasz Nowak

Check consistency of Sale Order before confirming it.

parent c33c66f5
......@@ -50,7 +50,8 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n
<value> <string>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
portal = context.getPortalObject()\n
setup_service_relative_url = portal.portal_preferences.getPreferredInstanceSetupResource()\n
for sale_order_line in portal.portal_catalog(\n
portal_type="Sale Order Line", \n
......@@ -60,10 +61,16 @@ for sale_order_line in portal.portal_catalog(\n
sale_order = sale_order_line.getParentValue()\n
if sale_order.getSimulationState() == \'ordered\':\n
try:\n
sale_order.confirm()\n
except ValueError:\n
# It was not possible to find free Computer Partition\n
sale_order.Base_checkConsistency()\n
except ValidationFailed:\n
# order not ready yet\n
continue\n
else:\n
try:\n
sale_order.confirm()\n
except ValueError:\n
# It was not possible to find free Computer Partition\n
continue\n
</string> </value>
</item>
<item>
......
524
\ No newline at end of file
525
\ 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