Odoo Help


How to remove seconds from a specific fields.Datetime field on a form view.

Pieter Paulussen
on 9/23/16, 10:57 AM 683 views

I need to hide the secondes from a fields.Datetime in a form view. What is the best way to do this?

Try by creating new widget for datetime, i don't know more


1) odoo-9.0c-20160806/openerp/addons/web/static/src/xml/base.xml

2) https://www.odoo.com/documentation/9.0/howtos/web.html#read-write-field

Shameem iWesabe
on 9/23/16, 10:54 PM

Yeah I'm more looking to an option like in qweb: t-field-option='{"hide_seconds":"True"}' 

Pieter Paulussen
on 9/25/16, 5:39 PM

Ermin Trevisan

--Ermin Trevisan--
| 6 4 7
Walchwil, Switzerland
--Ermin Trevisan--

Ermin Trevisan
On 9/24/16, 4:08 AM

I do that not only for particular forms, but generally for each database and language by specifying the corresponding time format under "Settings/Languages".

Fine :)

Shameem iWesabe
on 9/24/16, 5:00 AM

Shameem iWesabe

--Shameem iWesabe--
| 5 3 5
Calicut, India
--Shameem iWesabe--

Activities     :    Youtube



           iWesabe                                  ◉

           Axon Communications        ❍

           Cybrosys Technologies        ❍

Shameem iWesabe
On 9/26/16, 12:38 AM

Hi Pieter Paulussen,

You add a class to your date time filed and write a script. Then include maxlength property to the date to remove from right side.

For example

<script type="text/javascript">
     $('.your_date_field').css({"color": "red", "border": "2px solid red"});//TO TEST
<field name="date" class="your_date_field"/>  

Isn't the javascript supposed to be put after the field definition?

Also I think that when you want to extend the javascript, it's best to extend the full date-time widget rather than just changing the css.

Pieter Paulussen
on 9/26/16, 2:37 AM

Javascript near the field definition is not supposed :)

Shameem iWesabe
on 9/26/16, 5:02 AM

My code works, I tested

Shameem iWesabe
on 9/26/16, 5:04 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 9/23/16, 10:57 AM
Seen: 683 times
Last updated: 9/26/16, 12:38 AM