Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
6 Trả lời
17676 Lượt xem

I have a one datetime field called start_date.

If i fill the  start_date, it will show the date, hour, minute and seconds. eg (09/06/2017 12:55:49)

But i want to show only date, hour, minute and not need seconds. eg (09/06/2017 12:55)

Is there any possibility to show date, hour and minute in datetime field in odoo 10?.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

There is another option for Odoo v13, maybe, add t-options='{"widget": "date"}'

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

You'll want to format your date field in the view, if you're inheriting a view you can do:

        <field name="start_date" position="attributes">
<attribute name="t-options">{"format": "dd / MM / yyyy HH / mm"}</attribute> </field>


Note that the `HH` may need to be `hh`, i'm not 100% sure on that one.
Ảnh đại diện
Huỷ bỏ
Tác giả

Hi Peter,

Thanks. But I am not inheriting a view. I write a new view with state_date datetime field.

Could you please tell me any widgets to solve this problem.

Hi Priyait, then simply define the attribute on your field like so:

<field name="start_date" t-options="{'format': 'dd / MM / yyyy HH / mm'}"/>

Tác giả

Hi Peter,

I defined attribute on the field, but it still not working.

this code will not worked