Skip to Content
Menu
This question has been flagged
2 Replies
3862 Rodiniai

Image Preview

what i want to do in my custom form that is on image preview ...
what i have done .....

in Py

tz = fields.Selection('_tz_get', string='Timezone', required=True, default=lambda self: self.env.user.tz or 'UTC')

in XML

<field name="tz"/>​


Error is 

object has no attribute '_tz_get'

any solution please

Portretas
Atmesti
Best Answer

Hello, 

Try this maybe it should work.

import pytz

date_tz = fields.Selection('_tz_get', string='Timezone', required=True, default=lambda self: self.env.user.tz or 'UTC')

@api.model
def _tz_get(self):
return [(x, x) for x in pytz.all_timezones]




Portretas
Atmesti
Best Answer

Hello,

the definition of 'tz_get' is missing:

you must add in py file

import pytz
@api.model
def _tz_get(self):
return [(x, x) for x in pytz.all_timezones]
Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
2
bal. 23
3315
2
vas. 21
16469
1
spal. 20
3507
0
rugs. 16
4434
1
bal. 16
6801