Commit 8bc02232 authored by Łukasz Nowak's avatar Łukasz Nowak

Relax constraint.

Ordered orders can be without partition, but confirmed ones required it.
Also during confirmation check if partition was assigned correctly and
only then confirm order.
parent 480b8d29
......@@ -40,10 +40,22 @@
<key> <string>id</string> </key>
<value> <string>line_aggregate_computer_partition_constraint</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>max_arity</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>message_arity_with_portal_type_not_in_range</string> </key>
<value> <string>There should be exactly one ${portal_type} present in Items</string> </value>
......@@ -60,9 +72,21 @@
<key> <string>portal_type</string> </key>
<value> <string>Category Membership Arity Constraint</string> </value>
</item>
<item>
<key> <string>string_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>test_tales_expression</string> </key>
<value> <string>python: object.getResourceValue() is not None and object.getResource() in [object.portal_preferences.getPreferredInstanceSetupResource(), object.portal_preferences.getPreferredInstanceHostingResource(), object.portal_preferences.getPreferredInstanceCleanupResource()]</string> </value>
<value> <string>python: object.getSimulationState() == \'confirmed\' and object.getResourceValue() is not None and object.getResource() in [object.portal_preferences.getPreferredInstanceSetupResource(), object.portal_preferences.getPreferredInstanceHostingResource(), object.portal_preferences.getPreferredInstanceCleanupResource()]</string> </value>
</item>
<item>
<key> <string>use_acquisition</string> </key>
......
404
\ No newline at end of file
405
\ No newline at end of file
......@@ -84,11 +84,13 @@ def assignComputerPartition(order):\n
software_instance.getPortalType(), software_instance.getSlaXmlAsDict()])\n
order_line.edit(\n
aggregate_list=order_line.getAggregateList()+[computer_partition_relative_url])\n
return True\n
\n
sale_order = context.getParentValue()\n
if sale_order.getSimulationState() == \'ordered\':\n
assigned = False\n
try:\n
assignComputerPartition(sale_order)\n
assigned = assignComputerPartition(sale_order)\n
except ValueError:\n
# It was not possible to find free Computer Partition\n
pass\n
......@@ -102,6 +104,7 @@ if sale_order.getSimulationState() == \'ordered\':\n
# order not ready yet\n
pass\n
else:\n
if assigned:\n
sale_order.confirm()\n
</string> </value>
</item>
......
631
\ No newline at end of file
632
\ 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