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.
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')"/>
Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !
S'inscrire| Publications associées | Réponses | Vues | Activité | |
|---|---|---|---|---|
|
0
mars 18
|
5769 | |||
|
4
mars 16
|
8118 | |||
|
1
sept. 18
|
10306 | |||
|
0
mai 15
|
6482 | |||
|
0
juin 26
|
93 |
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.