Commit 15fffb62 authored by Jérome Perrin's avatar Jérome Perrin

Also handle items if value is not a list. This is for ListField support

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17258 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d57011ba
...@@ -245,11 +245,12 @@ bWxQSwUGAAAAAAIAAgCeAAAAhwwAAAAA</string> </value> ...@@ -245,11 +245,12 @@ bWxQSwUGAAAAAAIAAgCeAAAAhwwAAAAA</string> </value>
<table:table-cell table:style-name=\'field-table.B1\' office:value-type=\'string\'\n <table:table-cell table:style-name=\'field-table.B1\' office:value-type=\'string\'\n
tal:define="value python: field.get_value(\'default\')">\n tal:define="value python: field.get_value(\'default\')">\n
<tal:block tal:condition="python: same_type(value,[]) or same_type(value,())">\n <tal:block tal:condition="python: same_type(value,[]) or same_type(value,())">\n
<tal:block tal:condition="python: field.has_value(\'items\')"\n <tal:block tal:condition="python: field.has_value(\'items\')">\n
tal:define="field_item_dict python:dict([(x[1], x[0]) for x in field.get_value(\'items\')]);">\n <tal:block tal:define="field_item_dict python:dict([(x[1], x[0]) for x in field.get_value(\'items\')]);">\n
<tal:block tal:repeat="item value">\n <tal:block tal:repeat="item value">\n
<text:p text:style-name=\'field-content\'\n <text:p text:style-name=\'field-content\'\n
tal:content="python: field_item_dict.get(item, \'??? (%s)\' % item)"/>\n tal:content="python: field_item_dict.get(item, \'??? (%s)\' % item)"/>\n
</tal:block>\n
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
<tal:block tal:condition="python: not field.has_value(\'items\')">\n <tal:block tal:condition="python: not field.has_value(\'items\')">\n
...@@ -259,9 +260,16 @@ bWxQSwUGAAAAAAIAAgCeAAAAhwwAAAAA</string> </value> ...@@ -259,9 +260,16 @@ bWxQSwUGAAAAAAIAAgCeAAAAhwwAAAAA</string> </value>
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
<tal:block tal:condition="python: not (same_type(value, []) or same_type(value, ()))">\n <tal:block tal:condition="python: not (same_type(value, []) or same_type(value, ()))">\n
<text:p text:style-name=\'field-content\' tal:content="python: field.render_pdf(value)" />\n <tal:block tal:condition="python: field.has_value(\'items\')">\n
</tal:block>\n <tal:block tal:define="field_item_dict python:dict([(x[1], x[0]) for x in field.get_value(\'items\')]);"> \n
<text:p text:style-name=\'field-content\' tal:content="python: field_item_dict.get(value, \'??? (%s)\' % value)"/>\n
</tal:block>\n
</tal:block>\n
<tal:block tal:condition="python: not field.has_value(\'items\')">\n
<text:p text:style-name=\'field-content\' tal:content="python: field.render_pdf(value)" />\n
</tal:block>\n
</tal:block>\n
</table:table-cell>\n </table:table-cell>\n
</table:table-row>\n </table:table-row>\n
</tal:block>\n </tal:block>\n
......
14 15
\ No newline at end of file \ No newline at end of file
...@@ -85,13 +85,14 @@ ...@@ -85,13 +85,14 @@
</td>\n </td>\n
<td tal:attributes="colwidth python: None" tal:define="value python: field.get_value(\'default\')">\n <td tal:attributes="colwidth python: None" tal:define="value python: field.get_value(\'default\')">\n
<tal:block tal:condition="python: same_type(value,[]) or same_type(value,())">\n <tal:block tal:condition="python: same_type(value,[]) or same_type(value,())">\n
<tal:block tal:condition="python: field.has_value(\'items\')"\n <tal:block tal:condition="python: field.has_value(\'items\')">\n
tal:define="field_item_dict python:dict([(x[1], x[0]) for x in field.get_value(\'items\')]);">\n <tal:block tal:define="field_item_dict python:dict([(x[1], x[0]) for x in field.get_value(\'items\')]);">\n
<tal:block tal:repeat="item value">\n <tal:block tal:repeat="item value">\n
<para style="TableStandard"\n <para style="TableStandard"\n
tal:content="python: field_item_dict.get(item, \'??? (%s)\' % item)"/>\n tal:content="python: field_item_dict.get(item, \'??? (%s)\' % item)"/>\n
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
</tal:block>\n
<tal:block tal:condition="python: not field.has_value(\'items\')">\n <tal:block tal:condition="python: not field.has_value(\'items\')">\n
<tal:block tal:repeat="item value">\n <tal:block tal:repeat="item value">\n
<para style="TableStandard" tal:content="python: str(item)" />\n <para style="TableStandard" tal:content="python: str(item)" />\n
...@@ -99,7 +100,17 @@ ...@@ -99,7 +100,17 @@
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
<tal:block tal:condition="python: not (same_type(value, []) or same_type(value, ()) or same_type(value, None))">\n <tal:block tal:condition="python: not (same_type(value, []) or same_type(value, ()) or same_type(value, None))">\n
<para style="TableStandard" tal:content="python: field.render_pdf(value)" />\n <tal:block tal:condition="python: field.has_value(\'items\')">\n
<tal:block tal:define="field_item_dict python:dict([(x[1], x[0]) for x in field.get_value(\'items\')]);">\n
<!-- field.render_pdf should do this. Also the check field.has_value is wrong with RelationFields.\n
Fortunatly we don\'t use them in reports for now --> \n
<para style="TableStandard"\n
tal:content="python: field_item_dict.get(value, \'??? (%s)\' % value)"/>\n
</tal:block>\n
</tal:block>\n
<tal:block tal:condition="python: not field.has_value(\'items\')">\n
<para style="TableStandard" tal:content="python: field.render_pdf(value)" />\n
</tal:block>\n
</tal:block>\n </tal:block>\n
<tal:block tal:condition="python: value is None">\n <tal:block tal:condition="python: value is None">\n
<para style="TableStandard" tal:content="python: \' \'" />\n <para style="TableStandard" tal:content="python: \' \'" />\n
......
50 51
\ No newline at end of file \ No newline at end of file
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