Commit db0ab39a authored by Sebastien Robin's avatar Sebastien Robin

simulation: improve equivalence testers explanations messages

With latest simulation, the explanation given to user when solving a
divergence was not good enough :
- Property ids were displayed without possibility to display
  business word (like displaying 'stop_date' instead of
  'Delivery Date'
- Some message was displayed in the solve divergence dialog whatever
  was the equivalence tester behind. Therefore, customizations of
  messages made a equivalence tester level were not displayed to user

Therefore, following was done:
- in solve divergence dialog, include the message generated by the
  equivalence tester
- use tested_property_title to allow using business words to describe
  properties having divergence
- most equivalence testers are written in a way to evaluate divergence
  on a single property. To have better UI configuration of such equivalence
  testers, change tested_property and tested_property_title properties
  type from "lines" to "string". This required to add some backward
  compatible code.
- use Variation Divergence Tester to show a case of an equivalence
  tester using different properties. For this, add a property sheet
  dedicated to multi properties equivalence testers
- update propertysheets to allow translating tested_property_title
parent 93fbcdbb
......@@ -17,8 +17,6 @@
<value>
<tuple>
<string>action_type/object_view</string>
<string>portal_types/Trade Quantity Divergence Tester/1</string>
<string>portal_types/Float Divergence Tester/2</string>
</tuple>
</value>
</item>
......@@ -52,10 +50,6 @@
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>2.0</float> </value>
......@@ -66,7 +60,7 @@
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>0</int> </value>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
......@@ -79,7 +73,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/StringDivergenceTester_viewConfiguration</string> </value>
<value> <string>string:${object_url}/VariationDivergenceTester_viewConfiguration</string> </value>
</item>
</dictionary>
</pickle>
......
<property_sheet_list>
<portal_type id="Net Converted Quantity Divergence Tester">
<item>MultiPropertyEquivalenceTester</item>
</portal_type>
<portal_type id="Specialise Divergence Tester">
<item>SpecialiseEquivalenceTester</item>
</portal_type>
......
......@@ -11,17 +11,23 @@
<value>
<dictionary>
<item>
<key> <string>short_title</string> </key>
<key> <string>description</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<key> <string>short_title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
......@@ -77,6 +83,10 @@
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>type_class</string> </key>
<value> <string>CategoryMembershipEquivalenceTester</string> </value>
</item>
</dictionary>
</pickle>
</record>
......@@ -94,7 +104,7 @@
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>short_title</string> </value>
<value> <string>description</string> </value>
</item>
</dictionary>
</pickle>
......@@ -111,6 +121,23 @@
<none/>
</value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>short_title</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value> <string>erp5_ui</string> </value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>title</string> </value>
......
......@@ -11,17 +11,23 @@
<value>
<dictionary>
<item>
<key> <string>short_title</string> </key>
<key> <string>description</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<key> <string>short_title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
......@@ -49,6 +55,10 @@
<key> <string>type_acquire_local_rules</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>type_class</string> </key>
<value> <string>DateTimeEquivalenceTester</string> </value>
</item>
</dictionary>
</pickle>
</record>
......@@ -66,7 +76,7 @@
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>short_title</string> </value>
<value> <string>description</string> </value>
</item>
</dictionary>
</pickle>
......@@ -83,6 +93,23 @@
<none/>
</value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>short_title</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value> <string>erp5_ui</string> </value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>title</string> </value>
......
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_property_domain_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>acquire_local_roles</string> </key>
<value> <int>1</int> </value>
......@@ -58,6 +64,99 @@
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>type_class</string> </key>
<value> <string>FloatEquivalenceTester</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>description</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>description</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>short_title</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value> <string>erp5_ui</string> </value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>title</string> </value>
</item>
</dictionary>
</pickle>
</record>
......
......@@ -11,17 +11,23 @@
<value>
<dictionary>
<item>
<key> <string>short_title</string> </key>
<key> <string>description</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<key> <string>short_title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
......@@ -77,6 +83,10 @@
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>type_class</string> </key>
<value> <string>NetConvertedQuantityEquivalenceTester</string> </value>
</item>
</dictionary>
</pickle>
</record>
......@@ -94,7 +104,7 @@
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>short_title</string> </value>
<value> <string>description</string> </value>
</item>
</dictionary>
</pickle>
......@@ -111,6 +121,23 @@
<none/>
</value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>short_title</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value> <string>erp5_ui</string> </value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>title</string> </value>
......
......@@ -11,17 +11,23 @@
<value>
<dictionary>
<item>
<key> <string>short_title</string> </key>
<key> <string>description</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<key> <string>short_title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
......@@ -106,7 +112,7 @@
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>short_title</string> </value>
<value> <string>description</string> </value>
</item>
</dictionary>
</pickle>
......@@ -123,6 +129,23 @@
<none/>
</value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>short_title</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value> <string>erp5_ui</string> </value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>title</string> </value>
......
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_property_domain_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>acquire_local_roles</string> </key>
<value> <int>1</int> </value>
......@@ -58,6 +64,99 @@
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>type_class</string> </key>
<value> <string>StringEquivalenceTester</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>description</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>description</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>short_title</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value> <string>erp5_ui</string> </value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>title</string> </value>
</item>
</dictionary>
</pickle>
</record>
......
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_property_domain_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>acquire_local_roles</string> </key>
<value> <int>1</int> </value>
......@@ -58,6 +64,99 @@
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>type_class</string> </key>
<value> <string>VariationEquivalenceTester</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>description</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>description</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>short_title</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>domain_name</string> </key>
<value> <string>erp5_ui</string> </value>
</item>
<item>
<key> <string>property_name</string> </key>
<value> <string>title</string> </value>
</item>
</dictionary>
</pickle>
</record>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Property Sheet" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>MultiPropertyEquivalenceTester</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Property Sheet</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard Property" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>mode</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>elementary_type/lines</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Property used to test</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>tested_property_property</string> </value>
</item>
<item>
<key> <string>mode</string> </key>
<value> <string>w</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard Property</string> </value>
</item>
<item>
<key> <string>property_default</string> </key>
<value> <string>python: ()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard Property" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>mode</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>elementary_type/lines</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Title of the property used to test</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>tested_property_title_property</string> </value>
</item>
<item>
<key> <string>mode</string> </key>
<value> <string>w</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard Property</string> </value>
</item>
<item>
<key> <string>property_default</string> </key>
<value> <string>python: ()</string> </value>
</item>
<item>
<key> <string>translatable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>translation_domain</string> </key>
<value> <string>erp5_ui</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<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/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>Base_edit</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>my_tested_property_list</string>
<string>my_tested_property_title_list</string>
</list>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>VariationDivergenceTester_viewConfiguration</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>StringDivergenceTester_viewConfiguration</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_view</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Tester Configuration</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>update_action_title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="LinesField" module="Products.Formulator.StandardFields"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>my_tested_property_list</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>line_too_long</string> </key>
<value> <string>A line was too long.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
<item>
<key> <string>too_long</string> </key>
<value> <string>You entered too many characters.</string> </value>
</item>
<item>
<key> <string>too_many_lines</string> </key>
<value> <string>You entered too many lines.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>view_separator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>view_separator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <int>5</int> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Tested Properties</string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>view_separator</string> </key>
<value> <string encoding="cdata"><![CDATA[
<br />
]]></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <int>40</int> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="LinesField" module="Products.Formulator.StandardFields"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>my_tested_property_title_list</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>line_too_long</string> </key>
<value> <string>A line was too long.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
<item>
<key> <string>too_long</string> </key>
<value> <string>You entered too many characters.</string> </value>
</item>
<item>
<key> <string>too_many_lines</string> </key>
<value> <string>You entered too many lines.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>view_separator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>view_separator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <int>5</int> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Tested Property Titles</string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>view_separator</string> </key>
<value> <string encoding="cdata"><![CDATA[
<br />\n
]]></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <int>40</int> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Net Converted Quantity Divergence Tester | MultiPropertyEquivalenceTester
Specialise Divergence Tester | SpecialiseEquivalenceTester
\ No newline at end of file
SpecialiseEquivalenceTester
MultiPropertyEquivalenceTester
\ No newline at end of file
......@@ -59,6 +59,10 @@ class CategoryMembershipEquivalenceTester(Predicate, EquivalenceTesterMixin):
# What about using getCategoryMembershipList for Simulation Movements ?
return movement.getAcquiredCategoryMembershipList(property)
@staticmethod
def getTestedPropertyText(movement, property):
return ",".join([x.getTitleOrId() for x in movement.getAcquiredValueList(property)])
def _compare(self, prevision_movement, decision_movement, sorted=sorted):
"""
If prevision_movement and decision_movement don't match, it returns a
......@@ -82,11 +86,24 @@ class CategoryMembershipEquivalenceTester(Predicate, EquivalenceTesterMixin):
prevision_value = self._getTestedPropertyValue(prevision_movement,
tested_property)
# XXX do we have configurable parameter for this divergence tester ?
# like ambiguity...
property_name = getattr(self, 'getTranslatedTestedPropertyTitle', lambda: None)() or \
tested_property
if sorted(decision_value) != sorted(prevision_value):
return (
prevision_value, decision_value,
'The values of ${property_name} category are different between decision and prevision.',
dict(property_name=tested_property))
'There is difference of ${property_name} between decision \
${decision_value} and prevision ${prevision_value}',
dict(property_name=property_name,
prevision_value=self.getTestedPropertyText(
prevision_movement, tested_property),
decision_value=self.getTestedPropertyText(
decision_movement, tested_property)))
return None
# Temporary compatibility code that will fix existing data.
# This Code must be removed in 2 years (end of 2017)
from Products.ERP5.Document.StringEquivalenceTester import getTestedProperty
CategoryMembershipEquivalenceTester.getTestedProperty = getTestedProperty
......@@ -76,12 +76,18 @@ class DateTimeEquivalenceTester(Predicate, EquivalenceTesterMixin):
# for these properties.
absolute_tolerance_min = self.getProperty('quantity_range_min') or \
self.getProperty('quantity')
property_name = getattr(self, 'getTranslatedTestedPropertyTitle', lambda: None)() or \
tested_property
explanation_start = 'The difference of ${property_name} between decision \
${decision_value} and prevision ${prevision_value} '
if absolute_tolerance_min is not None and \
delta < absolute_tolerance_min:
return (
prevision_value, decision_value,
'The difference of ${property_name} between decision and prevision is less than ${value}.',
dict(property_name=tested_property,
explanation_start + 'is less than ${value}.',
dict(property_name=property_name,
decision_value=decision_value,
prevision_value=prevision_value,
value=absolute_tolerance_min))
absolute_tolerance_max = self.getProperty('quantity_range_max') or \
self.getProperty('quantity')
......@@ -89,6 +95,13 @@ class DateTimeEquivalenceTester(Predicate, EquivalenceTesterMixin):
delta > absolute_tolerance_max:
return (
prevision_value, decision_value,
'The difference of ${property_name} between decision and prevision is larger than ${value}.',
dict(property_name=tested_property,
explanation_start + 'is larger than ${value}.',
dict(property_name=property_name,
decision_value=decision_value,
prevision_value=prevision_value,
value=absolute_tolerance_max))
# Temporary compatibility code that will fix existing data.
# This Code must be removed in 2 years (end of 2017)
from Products.ERP5.Document.StringEquivalenceTester import getTestedProperty
DateTimeEquivalenceTester.getTestedProperty = getTestedProperty
......@@ -69,6 +69,8 @@ class FloatEquivalenceTester(Predicate, EquivalenceTesterMixin):
list : (prevision_value, decision_value, message, mapping)
"""
tested_property = self.getTestedProperty()
property_name = getattr(self, 'getTranslatedTestedPropertyTitle', lambda: None)() or \
tested_property
if getattr(decision_movement, 'isPropertyRecorded',
lambda x:False)(tested_property):
decision_value = decision_movement.getRecordedProperty(tested_property) or 0.0
......@@ -96,6 +98,15 @@ class FloatEquivalenceTester(Predicate, EquivalenceTesterMixin):
delta = abs(decision_value - prevision_value)
def getMappingDict(**kw):
mapping_dict = {'property_name': property_name,
'decision_value': decision_value,
'prevision_value': prevision_value}
mapping_dict.update(**kw)
return mapping_dict
explanation_start = 'The difference of ${property_name} between decision \
${decision_value} and prevision ${prevision_value} '
# XXX we should use appropriate property sheets and getter methods
# for these properties.
# Maybe, but beware of default values of quantity when doing so
......@@ -104,17 +115,15 @@ class FloatEquivalenceTester(Predicate, EquivalenceTesterMixin):
delta < (absolute_tolerance_min or - epsilon):
return (
prevision_value, decision_value,
'The difference of ${property_name} between decision and prevision is less than ${value}.',
dict(property_name=tested_property,
value=absolute_tolerance_min))
explanation_start + 'is less than ${value}.',
getMappingDict(value=absolute_tolerance_min))
absolute_tolerance_max = self.getProperty('quantity_range_max')
if absolute_tolerance_max is not None and \
delta > (absolute_tolerance_max or epsilon):
return (
prevision_value, decision_value,
'The difference of ${property_name} between decision and prevision is larger than ${value}.',
dict(property_name=tested_property,
value=absolute_tolerance_max))
explanation_start + 'is larger than ${value}.',
getMappingDict(value=absolute_tolerance_max))
tolerance_base = self.getProperty('tolerance_base')
base = None
......@@ -159,17 +168,15 @@ class FloatEquivalenceTester(Predicate, EquivalenceTesterMixin):
delta < relative_tolerance_min * base:
return (
prevision_value, decision_value,
'The difference of ${property_name} between decision and prevision is less than ${value} times of the prevision value.',
dict(property_name=tested_property,
value=relative_tolerance_min))
explanation_start + 'is less than ${value} times of the prevision value.',
getMappingDict(value=relative_tolerance_min))
relative_tolerance_max = self.getProperty('tolerance_range_max')
if relative_tolerance_max is not None and \
delta > relative_tolerance_max * base:
return (
prevision_value, decision_value,
'The difference of ${property_name} between decision and prevision is greater than ${value} times of the prevision value.',
dict(property_name=tested_property,
value=relative_tolerance_max))
explanation_start + 'is greater than ${value} times of the prevision value.',
getMappingDict(value=relative_tolerance_max))
def _round(self, value):
rounding_option = ROUNDING_OPTION_DICT[self.getDecimalRoundingOption()]
......@@ -185,3 +192,8 @@ class FloatEquivalenceTester(Predicate, EquivalenceTesterMixin):
# converted to Decimals everywhere, then the float() call should
# go away
return float(result)
# Temporary compatibility code that will fix existing data.
# This Code must be removed in 2 years (end of 2017)
from Products.ERP5.Document.StringEquivalenceTester import getTestedProperty
FloatEquivalenceTester.getTestedProperty = getTestedProperty
......@@ -74,8 +74,30 @@ class StringEquivalenceTester(Predicate, EquivalenceTesterMixin):
# XXX do we have configurable parameter for this divergence tester ?
# like ambiguity...
if decision_value != prevision_value:
property_name = getattr(self, 'getTranslatedTestedPropertyTitle', lambda: None)() or \
tested_property
return (
prevision_value, decision_value,
'The value of ${property_name} is different between decision and prevision.',
dict(property_name=tested_property))
'There is difference of ${property_name} between decision \
${decision_value} and prevision ${prevision_value}',
dict(property_name=property_name,
decision_value=decision_value,
prevision_value=prevision_value))
return None
# Temporary compatibility code that will fix existing data.
# This Code must be removed in 2 years (end of 2017)
def getTestedProperty(self):
"""
Override getTestedProperty to fix the way it is stored. Some time
ago it was multi-valued, which is non-sense we the implementation we
have on this equivalence tester.
"""
tested_property = getattr(self, 'tested_property', None)
if tested_property != None:
if isinstance(tested_property, tuple):
if len(tested_property) == 1:
setattr(self, 'tested_property', tested_property[0])
return self._baseGetTestedProperty()
StringEquivalenceTester.getTestedProperty = getTestedProperty
......@@ -79,10 +79,19 @@ class VariationEquivalenceTester(Predicate, EquivalenceTesterMixin):
# should not happen
raise AttributeError, 'prevision and decision values of this divergence tester should be list, tuple or dict.'
if not result:
property_name = tested_property
try:
# Get the property label to display to user
property_title_index = self.getTestedProperyList().index(tested_property)
# XXX We should use "getTranslatedTestedPropertyTitleList", but it seems to
# not exist for accessors having multiple possible values
property_name = self.getTestedPropertyTitleList()[property_title_index]
except ValueError, IndexError:
pass
return (
prevision_value, decision_value,
'The value of ${property_name} is different between decision and prevision.',
dict(property_name=tested_property))
dict(property_name=property_name))
return None
def generateHashKey(self, movement):
......
......@@ -51,6 +51,14 @@
<key> <string>property_default</string> </key>
<value> <string>python: ()</string> </value>
</item>
<item>
<key> <string>translatable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>translation_domain</string> </key>
<value> <string>erp5_ui</string> </value>
</item>
</dictionary>
</pickle>
</record>
......
......@@ -173,24 +173,27 @@ class EquivalenceTesterMixin:
return None
# XXX explanation message should be provided by each class, each
# portal type or each document.
message = '<a href="${decision_url}">${property_name} of ${decision_value} of ${decision_type} ${decision_title}</a> of <a href="${delivery_url}">${delivery_title}</a> is different from <a href="${prevision_url}">planned ${property_name} of ${prevision_value}</a>.'
introduction_message = 'On <a href="${decision_url}">${decision_type} ${decision_title}</a> '\
'of <a href="${delivery_url}">${delivery_title}</a> : '
decision_movement = self.getPortalObject().unrestrictedTraverse(
divergence_message.getProperty('object_relative_url'))
decision_delivery = decision_movement.getRootDeliveryValue()
mapping = {
introduction_mapping = {
'decision_url':decision_movement.absolute_url(),
# TODO we need a way to map the property name to the business word,
# eg. 'start_date' to 'Delivery Date' for trade etc.
'property_name':divergence_message.getProperty('tested_property'),
'decision_value':h(divergence_message.getProperty('decision_value')),
'decision_type':decision_movement.getPortalType(),
'decision_type':decision_movement.getTranslatedPortalType(),
'decision_title':h(decision_movement.getTitleOrId()),
'delivery_url':decision_delivery.absolute_url(),
'delivery_title':h(decision_delivery.getTitleOrId()),
'prevision_url':'#', # XXX it should be a link to the detailed view.
'prevision_value':h(divergence_message.getProperty('prevision_value')),
# For example, we might want to show a partial view of
# the original order associated with partial view of
# related packing list
}
return str(Message(domain='erp5_ui', message=message, mapping=mapping))
message = divergence_message.getProperty('message')
mapping = dict([(x, h(y)) for (x,y) in divergence_message.getProperty('mapping', {}).items()])
return str(Message(domain='erp5_ui', message=introduction_message,
mapping=introduction_mapping)) \
+ str(Message(domain='erp5_ui', message=message, mapping=mapping))
# Placeholder for methods to override
def _compare(self, prevision_movement, decision_movement):
......
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