Commit b30ede57 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Listfield: always send the default_%s:int:0 value

Compatibility
parent dab26b0d
/*global window, rJS, isEmpty, getFirstNonEmpty, ensureArray */ /*global window, rJS, isEmpty, getFirstNonEmpty, ensureArray, isEmpty */
/*jslint nomen: true, indent: 2, maxerr: 3, maxlen: 80 */ /*jslint nomen: true, indent: 2, maxerr: 3, maxlen: 80 */
(function (window, rJS, getFirstNonEmpty, ensureArray) { (function (window, rJS, getFirstNonEmpty, ensureArray, isEmpty) {
"use strict"; "use strict";
rJS(window) rJS(window)
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
text_content = item_list[i][0]; text_content = item_list[i][0];
} }
} }
if (text_content === undefined) { if ((text_content === undefined) && !isEmpty(this.state.value)) {
text_content = '??? (' + this.state.value + ')'; text_content = '??? (' + this.state.value + ')';
} }
state.text_content = text_content; state.text_content = text_content;
...@@ -90,6 +90,7 @@ ...@@ -90,6 +90,7 @@
}) })
.declareMethod('getContent', function () { .declareMethod('getContent', function () {
var context = this;
if (this.state.editable) { if (this.state.editable) {
return this.getDeclaredGadget('sub') return this.getDeclaredGadget('sub')
.push(function (gadget) { .push(function (gadget) {
...@@ -100,10 +101,7 @@ ...@@ -100,10 +101,7 @@
// Automatically add default_%s:int:0 // Automatically add default_%s:int:0
// https://lab.nexedi.com/nexedi/erp5/blob/8ae0706177/product/Formulator/Widget.py#L1147 // https://lab.nexedi.com/nexedi/erp5/blob/8ae0706177/product/Formulator/Widget.py#L1147
/*jslint maxlen: 80 */ /*jslint maxlen: 80 */
var key_list = Object.keys(result), i; result["default_" + context.state.name + ":int"] = 0;
for (i = 0; i < key_list.length; i += 1) {
result["default_" + key_list[i] + ":int"] = 0;
}
return result; return result;
}); });
} }
...@@ -120,4 +118,4 @@ ...@@ -120,4 +118,4 @@
return true; return true;
}, {mutex: 'changestate'}); }, {mutex: 'changestate'});
}(window, rJS, getFirstNonEmpty, ensureArray)); }(window, rJS, getFirstNonEmpty, ensureArray, isEmpty));
\ No newline at end of file \ No newline at end of file
...@@ -148,11 +148,13 @@ ...@@ -148,11 +148,13 @@
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<key> <string>_log</string> </key>
<value>
<list> <list>
<dictionary> <dictionary>
<item> <item>
...@@ -196,16 +198,20 @@ ...@@ -196,16 +198,20 @@
</item> </item>
</dictionary> </dictionary>
</list> </list>
</tuple> </value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
<record id="4" aka="AAAAAAAAAAQ="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<key> <string>_log</string> </key>
<value>
<list> <list>
<dictionary> <dictionary>
<item> <item>
...@@ -228,7 +234,7 @@ ...@@ -228,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>975.29304.53589.37529</string> </value> <value> <string>979.41914.53909.44561</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -246,7 +252,7 @@ ...@@ -246,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1556814300.71</float> <float>1573126833.72</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
...@@ -255,16 +261,20 @@ ...@@ -255,16 +261,20 @@
</item> </item>
</dictionary> </dictionary>
</list> </list>
</tuple> </value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
<record id="5" aka="AAAAAAAAAAU="> <record id="5" aka="AAAAAAAAAAU=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<key> <string>_log</string> </key>
<value>
<list> <list>
<dictionary> <dictionary>
<item> <item>
...@@ -312,7 +322,9 @@ ...@@ -312,7 +322,9 @@
</item> </item>
</dictionary> </dictionary>
</list> </list>
</tuple> </value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
</ZopeData> </ZopeData>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment