Commit 92b3e065 authored by Nicolas Delaby's avatar Nicolas Delaby

Render odg_view must not fallback on render_odt as nodes are different in ODT and ODG.

DateTimeWidget.render_odg_view consist into transform DateTime value into string
then call default render_odg_view renderer with casted value.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40521 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 69a10af9
......@@ -1490,15 +1490,16 @@ class DateTimeWidget(Widget):
return etree.tostring(text_node)
return text_node
def render_odg(self, field, value, as_string, ooo_builder, REQUEST,
render_prefix, attr_dict, local_name):
"""
Return a field value rendered in odt format.
- as_string return value as string or as xml object
- attr_dict can be used for additional attributes (like style).
def render_odg_view(self, field, value, as_string, ooo_builder, REQUEST,
render_prefix, attr_dict, local_name):
"""Transform DateTime into string then call default renderer
"""
return self.render_odt(field, value, as_string, ooo_builder, REQUEST,
render_prefix, attr_dict, local_name)
if not value and field.get_value('default_now'):
value = DateTime()
value_as_text = self.format_value(field, value, mode='pdf').decode('utf-8')
return Widget.render_odg_view(self, field, value_as_text, as_string,
ooo_builder, REQUEST, render_prefix,
attr_dict, local_name)
DateTimeWidgetInstance = DateTimeWidget()
......
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