I want to display and make selectable a particular datetime field in 12 hour format in Odoo 8. Generically, it is done by Settings->Translation->Time Format , but i want to do it with a single field on form view.
Any help will be highly appreciated.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
I want to display and make selectable a particular datetime field in 12 hour format in Odoo 8. Generically, it is done by Settings->Translation->Time Format , but i want to do it with a single field on form view.
Any help will be highly appreciated.
Hello you can try below process :
Translations --> Language --> Edit
Replace time format : %H:%M:%S to %I:%M:%S %p
import following:
from odoo.tools import float_is_zero, float_compare, DEFAULT_SERVER_DATETIME_FORMAT
define in your function in place of time format DEFAULT_SERVER_DATETIME_FORMAT i hope it helps you.
For Reports and XML(QWeb) you can do it this way:
<span t-esc="datetime.datetime.strptime(object.date, '%Y-%m-%d %H:%M:%S').strftime('%d/%m/%Y %I:%M:%S %p')"/>
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
0
Mar 18
|
3363 | ||
|
4
Mar 16
|
5887 | ||
|
1
Sep 18
|
7696 | ||
|
0
May 15
|
4104 | ||
Line Spacing in Odoo 17
Solved
|
|
1
Dec 24
|
432 |