Commit b4361eb8 authored by Sebastien Robin's avatar Sebastien Robin Committed by Arnaud Fontaine

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 45790980
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
<value> <value>
<tuple> <tuple>
<string>action_type/object_view</string> <string>action_type/object_view</string>
<string>portal_types/Trade Quantity Divergence Tester/1</string>
<string>portal_types/Float Divergence Tester/2</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -52,10 +50,6 @@ ...@@ -52,10 +50,6 @@
</tuple> </tuple>
</value> </value>
</item> </item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item> <item>
<key> <string>priority</string> </key> <key> <string>priority</string> </key>
<value> <float>2.0</float> </value> <value> <float>2.0</float> </value>
...@@ -66,7 +60,7 @@ ...@@ -66,7 +60,7 @@
</item> </item>
<item> <item>
<key> <string>visible</string> </key> <key> <string>visible</string> </key>
<value> <int>0</int> </value> <value> <int>1</int> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
...@@ -79,7 +73,7 @@ ...@@ -79,7 +73,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>string:${object_url}/StringDivergenceTester_viewConfiguration</string> </value> <value> <string>string:${object_url}/VariationDivergenceTester_viewConfiguration</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
<property_sheet_list> <property_sheet_list>
<portal_type id="Net Converted Quantity Divergence Tester">
<item>MultiPropertyEquivalenceTester</item>
</portal_type>
<portal_type id="Specialise Divergence Tester"> <portal_type id="Specialise Divergence Tester">
<item>SpecialiseEquivalenceTester</item> <item>SpecialiseEquivalenceTester</item>
</portal_type> </portal_type>
......
...@@ -11,17 +11,23 @@ ...@@ -11,17 +11,23 @@
<value> <value>
<dictionary> <dictionary>
<item> <item>
<key> <string>short_title</string> </key> <key> <string>description</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>short_title</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
<item>
<key> <string>title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
...@@ -98,7 +104,7 @@ ...@@ -98,7 +104,7 @@
</item> </item>
<item> <item>
<key> <string>property_name</string> </key> <key> <string>property_name</string> </key>
<value> <string>short_title</string> </value> <value> <string>description</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
...@@ -115,6 +121,23 @@ ...@@ -115,6 +121,23 @@
<none/> <none/>
</value> </value>
</item> </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> <item>
<key> <string>property_name</string> </key> <key> <string>property_name</string> </key>
<value> <string>title</string> </value> <value> <string>title</string> </value>
......
...@@ -11,17 +11,23 @@ ...@@ -11,17 +11,23 @@
<value> <value>
<dictionary> <dictionary>
<item> <item>
<key> <string>short_title</string> </key> <key> <string>description</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>short_title</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
<item>
<key> <string>title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
...@@ -70,7 +76,7 @@ ...@@ -70,7 +76,7 @@
</item> </item>
<item> <item>
<key> <string>property_name</string> </key> <key> <string>property_name</string> </key>
<value> <string>short_title</string> </value> <value> <string>description</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
...@@ -87,6 +93,23 @@ ...@@ -87,6 +93,23 @@
<none/> <none/>
</value> </value>
</item> </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> <item>
<key> <string>property_name</string> </key> <key> <string>property_name</string> </key>
<value> <string>title</string> </value> <value> <string>title</string> </value>
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_property_domain_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>acquire_local_roles</string> </key> <key> <string>acquire_local_roles</string> </key>
<value> <int>1</int> </value> <value> <int>1</int> </value>
...@@ -65,4 +71,93 @@ ...@@ -65,4 +71,93 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </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>
</ZopeData> </ZopeData>
...@@ -11,17 +11,23 @@ ...@@ -11,17 +11,23 @@
<value> <value>
<dictionary> <dictionary>
<item> <item>
<key> <string>short_title</string> </key> <key> <string>description</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>short_title</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
<item>
<key> <string>title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
...@@ -98,7 +104,7 @@ ...@@ -98,7 +104,7 @@
</item> </item>
<item> <item>
<key> <string>property_name</string> </key> <key> <string>property_name</string> </key>
<value> <string>short_title</string> </value> <value> <string>description</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
...@@ -115,6 +121,23 @@ ...@@ -115,6 +121,23 @@
<none/> <none/>
</value> </value>
</item> </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> <item>
<key> <string>property_name</string> </key> <key> <string>property_name</string> </key>
<value> <string>title</string> </value> <value> <string>title</string> </value>
......
...@@ -11,17 +11,23 @@ ...@@ -11,17 +11,23 @@
<value> <value>
<dictionary> <dictionary>
<item> <item>
<key> <string>short_title</string> </key> <key> <string>description</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>short_title</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
<item>
<key> <string>title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
...@@ -106,7 +112,7 @@ ...@@ -106,7 +112,7 @@
</item> </item>
<item> <item>
<key> <string>property_name</string> </key> <key> <string>property_name</string> </key>
<value> <string>short_title</string> </value> <value> <string>description</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
...@@ -123,6 +129,23 @@ ...@@ -123,6 +129,23 @@
<none/> <none/>
</value> </value>
</item> </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> <item>
<key> <string>property_name</string> </key> <key> <string>property_name</string> </key>
<value> <string>title</string> </value> <value> <string>title</string> </value>
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_property_domain_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>acquire_local_roles</string> </key> <key> <string>acquire_local_roles</string> </key>
<value> <int>1</int> </value> <value> <int>1</int> </value>
...@@ -65,4 +71,93 @@ ...@@ -65,4 +71,93 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </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>
</ZopeData> </ZopeData>
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_property_domain_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>acquire_local_roles</string> </key> <key> <string>acquire_local_roles</string> </key>
<value> <int>1</int> </value> <value> <int>1</int> </value>
...@@ -65,4 +71,93 @@ ...@@ -65,4 +71,93 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </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>
</ZopeData> </ZopeData>
<?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 Specialise Divergence Tester | SpecialiseEquivalenceTester
\ No newline at end of file
SpecialiseEquivalenceTester SpecialiseEquivalenceTester
MultiPropertyEquivalenceTester
\ No newline at end of file
...@@ -59,6 +59,10 @@ class CategoryMembershipEquivalenceTester(Predicate, EquivalenceTesterMixin): ...@@ -59,6 +59,10 @@ class CategoryMembershipEquivalenceTester(Predicate, EquivalenceTesterMixin):
# What about using getCategoryMembershipList for Simulation Movements ? # What about using getCategoryMembershipList for Simulation Movements ?
return movement.getAcquiredCategoryMembershipList(property) 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): def _compare(self, prevision_movement, decision_movement, sorted=sorted):
""" """
If prevision_movement and decision_movement don't match, it returns a If prevision_movement and decision_movement don't match, it returns a
...@@ -82,11 +86,24 @@ class CategoryMembershipEquivalenceTester(Predicate, EquivalenceTesterMixin): ...@@ -82,11 +86,24 @@ class CategoryMembershipEquivalenceTester(Predicate, EquivalenceTesterMixin):
prevision_value = self._getTestedPropertyValue(prevision_movement, prevision_value = self._getTestedPropertyValue(prevision_movement,
tested_property) tested_property)
# XXX do we have configurable parameter for this divergence tester ? # XXX do we have configurable parameter for this divergence tester ?
# like ambiguity... # like ambiguity...
property_name = getattr(self, 'getTranslatedTestedPropertyTitle', lambda: None)() or \
tested_property
if sorted(decision_value) != sorted(prevision_value): if sorted(decision_value) != sorted(prevision_value):
return ( return (
prevision_value, decision_value, prevision_value, decision_value,
'The values of ${property_name} category are different between decision and prevision.', 'There is difference of ${property_name} between decision \
dict(property_name=tested_property)) ${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 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): ...@@ -76,12 +76,18 @@ class DateTimeEquivalenceTester(Predicate, EquivalenceTesterMixin):
# for these properties. # for these properties.
absolute_tolerance_min = self.getProperty('quantity_range_min') or \ absolute_tolerance_min = self.getProperty('quantity_range_min') or \
self.getProperty('quantity') 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 \ if absolute_tolerance_min is not None and \
delta < absolute_tolerance_min: delta < absolute_tolerance_min:
return ( return (
prevision_value, decision_value, prevision_value, decision_value,
'The difference of ${property_name} between decision and prevision is less than ${value}.', explanation_start + 'is less than ${value}.',
dict(property_name=tested_property, dict(property_name=property_name,
decision_value=decision_value,
prevision_value=prevision_value,
value=absolute_tolerance_min)) value=absolute_tolerance_min))
absolute_tolerance_max = self.getProperty('quantity_range_max') or \ absolute_tolerance_max = self.getProperty('quantity_range_max') or \
self.getProperty('quantity') self.getProperty('quantity')
...@@ -89,6 +95,13 @@ class DateTimeEquivalenceTester(Predicate, EquivalenceTesterMixin): ...@@ -89,6 +95,13 @@ class DateTimeEquivalenceTester(Predicate, EquivalenceTesterMixin):
delta > absolute_tolerance_max: delta > absolute_tolerance_max:
return ( return (
prevision_value, decision_value, prevision_value, decision_value,
'The difference of ${property_name} between decision and prevision is larger than ${value}.', explanation_start + 'is larger than ${value}.',
dict(property_name=tested_property, dict(property_name=property_name,
decision_value=decision_value,
prevision_value=prevision_value,
value=absolute_tolerance_max)) 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
...@@ -87,6 +87,8 @@ class FloatEquivalenceTester(Predicate, EquivalenceTesterMixin): ...@@ -87,6 +87,8 @@ class FloatEquivalenceTester(Predicate, EquivalenceTesterMixin):
prevision_movement, prevision_value, prevision_movement, prevision_value,
decision_movement, decision_value): decision_movement, decision_value):
tested_property = self.getTestedProperty() tested_property = self.getTestedProperty()
property_name = getattr(self, 'getTranslatedTestedPropertyTitle', lambda: None)() or \
tested_property
if prevision_movement.getDelivery() == decision_movement.getRelativeUrl(): if prevision_movement.getDelivery() == decision_movement.getRelativeUrl():
# use delivery_ratio if specified # use delivery_ratio if specified
if self.getProperty('use_delivery_ratio'): if self.getProperty('use_delivery_ratio'):
...@@ -105,6 +107,15 @@ class FloatEquivalenceTester(Predicate, EquivalenceTesterMixin): ...@@ -105,6 +107,15 @@ class FloatEquivalenceTester(Predicate, EquivalenceTesterMixin):
delta = abs(decision_value - prevision_value) 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 # XXX we should use appropriate property sheets and getter methods
# for these properties. # for these properties.
# Maybe, but beware of default values of quantity when doing so # Maybe, but beware of default values of quantity when doing so
...@@ -113,17 +124,15 @@ class FloatEquivalenceTester(Predicate, EquivalenceTesterMixin): ...@@ -113,17 +124,15 @@ class FloatEquivalenceTester(Predicate, EquivalenceTesterMixin):
delta < (absolute_tolerance_min or - epsilon): delta < (absolute_tolerance_min or - epsilon):
return ( return (
prevision_value, decision_value, prevision_value, decision_value,
'The difference of ${property_name} between decision and prevision is less than ${value}.', explanation_start + 'is less than ${value}.',
dict(property_name=tested_property, getMappingDict(value=absolute_tolerance_min))
value=absolute_tolerance_min))
absolute_tolerance_max = self.getProperty('quantity_range_max') absolute_tolerance_max = self.getProperty('quantity_range_max')
if absolute_tolerance_max is not None and \ if absolute_tolerance_max is not None and \
delta > (absolute_tolerance_max or epsilon): delta > (absolute_tolerance_max or epsilon):
return ( return (
prevision_value, decision_value, prevision_value, decision_value,
'The difference of ${property_name} between decision and prevision is larger than ${value}.', explanation_start + 'is larger than ${value}.',
dict(property_name=tested_property, getMappingDict(value=absolute_tolerance_max))
value=absolute_tolerance_max))
tolerance_base = self.getProperty('tolerance_base') tolerance_base = self.getProperty('tolerance_base')
base = None base = None
...@@ -168,17 +177,15 @@ class FloatEquivalenceTester(Predicate, EquivalenceTesterMixin): ...@@ -168,17 +177,15 @@ class FloatEquivalenceTester(Predicate, EquivalenceTesterMixin):
delta < relative_tolerance_min * base: delta < relative_tolerance_min * base:
return ( return (
prevision_value, decision_value, prevision_value, decision_value,
'The difference of ${property_name} between decision and prevision is less than ${value} times of the prevision value.', explanation_start + 'is less than ${value} times of the prevision value.',
dict(property_name=tested_property, getMappingDict(value=relative_tolerance_min))
value=relative_tolerance_min))
relative_tolerance_max = self.getProperty('tolerance_range_max') relative_tolerance_max = self.getProperty('tolerance_range_max')
if relative_tolerance_max is not None and \ if relative_tolerance_max is not None and \
delta > relative_tolerance_max * base: delta > relative_tolerance_max * base:
return ( return (
prevision_value, decision_value, prevision_value, decision_value,
'The difference of ${property_name} between decision and prevision is greater than ${value} times of the prevision value.', explanation_start + 'is greater than ${value} times of the prevision value.',
dict(property_name=tested_property, getMappingDict(value=relative_tolerance_max))
value=relative_tolerance_max))
def _round(self, value): def _round(self, value):
rounding_option = ROUNDING_OPTION_DICT[self.getDecimalRoundingOption()] rounding_option = ROUNDING_OPTION_DICT[self.getDecimalRoundingOption()]
...@@ -194,3 +201,8 @@ class FloatEquivalenceTester(Predicate, EquivalenceTesterMixin): ...@@ -194,3 +201,8 @@ class FloatEquivalenceTester(Predicate, EquivalenceTesterMixin):
# converted to Decimals everywhere, then the float() call should # converted to Decimals everywhere, then the float() call should
# go away # go away
return float(result) 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): ...@@ -74,8 +74,30 @@ class StringEquivalenceTester(Predicate, EquivalenceTesterMixin):
# XXX do we have configurable parameter for this divergence tester ? # XXX do we have configurable parameter for this divergence tester ?
# like ambiguity... # like ambiguity...
if decision_value != prevision_value: if decision_value != prevision_value:
property_name = getattr(self, 'getTranslatedTestedPropertyTitle', lambda: None)() or \
tested_property
return ( return (
prevision_value, decision_value, prevision_value, decision_value,
'The value of ${property_name} is different between decision and prevision.', 'There is difference of ${property_name} between decision \
dict(property_name=tested_property)) ${decision_value} and prevision ${prevision_value}',
dict(property_name=property_name,
decision_value=decision_value,
prevision_value=prevision_value))
return None 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): ...@@ -79,10 +79,19 @@ class VariationEquivalenceTester(Predicate, EquivalenceTesterMixin):
# should not happen # should not happen
raise AttributeError, 'prevision and decision values of this divergence tester should be list, tuple or dict.' raise AttributeError, 'prevision and decision values of this divergence tester should be list, tuple or dict.'
if not result: 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 ( return (
prevision_value, decision_value, prevision_value, decision_value,
'The value of ${property_name} is different between decision and prevision.', 'The value of ${property_name} is different between decision and prevision.',
dict(property_name=tested_property)) dict(property_name=property_name))
return None return None
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<key> <string>categories</string> </key> <key> <string>categories</string> </key>
<value> <value>
<tuple> <tuple>
<string>elementary_type/lines</string> <string>elementary_type/string</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
</item> </item>
<item> <item>
<key> <string>property_default</string> </key> <key> <string>property_default</string> </key>
<value> <string>python: ()</string> </value> <value> <string>python: None</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -49,7 +49,15 @@ ...@@ -49,7 +49,15 @@
</item> </item>
<item> <item>
<key> <string>property_default</string> </key> <key> <string>property_default</string> </key>
<value> <string>python: ()</string> </value> <value> <string>python: None</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> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -181,24 +181,27 @@ class EquivalenceTesterMixin: ...@@ -181,24 +181,27 @@ class EquivalenceTesterMixin:
return None return None
# XXX explanation message should be provided by each class, each # XXX explanation message should be provided by each class, each
# portal type or each document. # 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( decision_movement = self.getPortalObject().unrestrictedTraverse(
divergence_message.getProperty('object_relative_url')) divergence_message.getProperty('object_relative_url'))
decision_delivery = decision_movement.getRootDeliveryValue() decision_delivery = decision_movement.getRootDeliveryValue()
mapping = { introduction_mapping = {
'decision_url':decision_movement.absolute_url(), 'decision_url':decision_movement.absolute_url(),
# TODO we need a way to map the property name to the business word, 'decision_type':decision_movement.getTranslatedPortalType(),
# 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_title':h(decision_movement.getTitleOrId()), 'decision_title':h(decision_movement.getTitleOrId()),
'delivery_url':decision_delivery.absolute_url(), 'delivery_url':decision_delivery.absolute_url(),
'delivery_title':h(decision_delivery.getTitleOrId()), 'delivery_title':h(decision_delivery.getTitleOrId()),
'prevision_url':'#', # XXX it should be a link to the detailed view. '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 # Placeholder for methods to override
def _compare(self, prevision_movement, decision_movement): 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