Aide

0

How i can take TimeZone Field into my custom model and form in Odoo 12

Avatar
Usman

Image Preview

i need Time Zone Field into my Custom Form how i can take this field into my model and show into my form



Avatar
Annuler
1 Réponse
0
Avatar
GiusyG
Meilleure réponse

Hi, you can use this field


date_tz      = fields.Selection('_tz_get', string='Timezone', required=True,
default=lambda self: self.env.user.tz or 'UTC')
2 Commentaires
Avatar
Annuler
Avatar
Usman
-

Not working

error is

object has no attribute '_tz_get'

Avatar
GiusyG
-

you must add:

import pytz

@api.model

def _tz_get(self):

return [(x, x) for x in pytz.all_timezones]