How can I output a odoo 8 datetime field without time on a qweb report?

11,102

Solution 1

You could try specifying a format in t-field-options, like this:

<span t-field="object.datetimefield" t-field-options='{"format": "MMMM d y"}'/>

just adjust the format as you want.

Solution 2

I have just faced this issue and now it's possible to do it in an easy way. This way shows only the date without the time in addition to keep the respective format lang of the date according to the user who printed the report.

<p t-field="o.your_datetime_field" t-field-options='{"widget": "date"}'/>

Warning: the quotes of t-field-options must be exactly like I wrote, otherwise, that line won't work.

Hope it helps in the future to anyone who needs this.

Share:
11,102
user2460152
Author by

user2460152

Updated on June 11, 2022

Comments

  • user2460152
    user2460152 almost 2 years

    I want to output a odoo 8 datetime field in the localization format but without time.

    I extended the t-field with the option hide_time. Is there a simpler built-in solution?

  • Nathan Tuggy
    Nathan Tuggy over 9 years
    This doesn't seem to preserve localization choices.
  • qatz
    qatz over 9 years
    Ups, I didn't noticed about it. Maybe this could help : odoo.com/es_ES/forum/help-1/question/…
  • travisw
    travisw about 7 years
    This is easily the simplest and most flexible option. Works great in Odoo 9. Thanks!