Commit c19aa32c authored by Jérome Perrin's avatar Jérome Perrin

simulation: don't ask user to choose a delivery solver when only one is configured

In order to make solving divergences easier, we sometimes don't need to
show the delivery solver (priority) field when the solver only allow
one.
parent 4c55f0cb
......@@ -10,8 +10,10 @@
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>css_class</string>
<string>default</string>
<string>external_validator</string>
<string>hidden</string>
<string>items</string>
<string>title</string>
</list>
......@@ -64,11 +66,17 @@
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<key> <string>css_class</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
......@@ -81,10 +89,16 @@
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
<item>
......@@ -102,6 +116,10 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
......@@ -109,7 +127,7 @@
<item>
<key> <string>external_validator</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent>
</value>
</item>
<item>
......@@ -120,6 +138,10 @@
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
......@@ -152,7 +174,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python:here.getConfigurationPropertyDict().get(\'delivery_solver\', None)</string> </value>
<value> <string>python: "hidden_label" if here.SolverDecision_getDefaultDeliverySolverIfUnique() else ""</string> </value>
</item>
</dictionary>
</pickle>
......@@ -165,12 +187,38 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python:[(here.Base_translateString(x.getSolverActionTitle() or \'\'), x.getId()) for x in here.searchDeliverySolverList()]</string> </value>
<value> <string>python:here.getConfigurationPropertyDict().get(\'delivery_solver\') or here.SolverDecision_getDefaultDeliverySolverIfUnique()</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: here.SolverDecision_getDefaultDeliverySolverIfUnique()</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python:[(here.Base_translateString(x.getSolverActionTitle() or \'\'), x.getId()) for x in here.searchDeliverySolverList()]</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="6" aka="AAAAAAAAAAY=">
<pickle>
<global name="Method" module="Products.Formulator.MethodField"/>
</pickle>
......
# type: () -> Optional[str]
"""Returns the id of delivery solver if there's only one configured
on this solver, None otherwise.
"""
delivery_solver_list = context.searchDeliverySolverList()
if len(delivery_solver_list) == 1:
return delivery_solver_list[0].getId()
<?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>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SolverDecision_getDefaultDeliverySolverIfUnique</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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