This question has been flagged
1 Reply
3129 Views

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
Discard
Best Answer

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')
Avatar
Discard
Author

Not working

error is

object has no attribute '_tz_get'

you must add:

import pytz

@api.model

def _tz_get(self):

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