コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
3815 ビュー

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

アバター
破棄
最善の回答

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]




アバター
破棄
最善の回答

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]
アバター
破棄
関連投稿 返信 ビュー 活動
2
4月 23
3263
2
2月 21
16426
1
10月 20
3478
0
9月 16
4407
1
4月 16
6749