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

Check consistency of Sale Order before confirming it.

parent c33c66f5
...@@ -50,7 +50,8 @@ ...@@ -50,7 +50,8 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <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 setup_service_relative_url = portal.portal_preferences.getPreferredInstanceSetupResource()\n
for sale_order_line in portal.portal_catalog(\n for sale_order_line in portal.portal_catalog(\n
portal_type="Sale Order Line", \n portal_type="Sale Order Line", \n
...@@ -59,6 +60,12 @@ for sale_order_line in portal.portal_catalog(\n ...@@ -59,6 +60,12 @@ for sale_order_line in portal.portal_catalog(\n
):\n ):\n
sale_order = sale_order_line.getParentValue()\n sale_order = sale_order_line.getParentValue()\n
if sale_order.getSimulationState() == \'ordered\':\n if sale_order.getSimulationState() == \'ordered\':\n
try:\n
sale_order.Base_checkConsistency()\n
except ValidationFailed:\n
# order not ready yet\n
continue\n
else:\n
try:\n try:\n
sale_order.confirm()\n sale_order.confirm()\n
except ValueError:\n except ValueError:\n
......
524 525
\ 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