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

ERP5Form/hal_json: support disabled items in ParallelListField

(Multi)ListField renders items with None as value as disabled option, but this
was not really supported in ParallelListField because ParallelListField treated
the same way the empty ('', '') item and a disabled item ("Disabled", None).

Adjust the conditions to differentiate the two cases.
parent 68723415
......@@ -480,7 +480,7 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None, k
# Copy the dict, as some hashscript cache the result,
# which should not in this case be modified
result.update({"subfield_list": [x.copy() for x in getattr(field, hash_script_id)(
[x for x in result['items'] if (x[1] and x[0])],
[x for x in result['items'] if (x[1] != '' and x[0] != '')],
# Drop empty values
result['default'],
default_sub_field_property_dict={
......
......@@ -229,7 +229,7 @@ class ParallelListField(ZMIField):
def generateSubForm(self, value, REQUEST):
item_list = [x for x in self.get_value('items', REQUEST=REQUEST)
if x[0] != '' and x[1]]
if x[0] != '' and x[1] != '']
value_list = value
if not isinstance(value_list, (list, tuple)):
......
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