Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
3202 Widoki

Hello,


I try to get the time in the user's time zone. Here is my code, generating an error:


user_tz = self.env.user.tz
MyDate = record.x_studio_approved_date_time_exit.user_tz
record['x_studio_time_exit'] = MyDate.strftime("%H:%M")


But it gives me an error... since the ".user_tz" is not supported.


Can you tell me how to solve this?


Thank you!




Awatar
Odrzuć
Autor Najlepsza odpowiedź

no, error is

ValueError: : "name 'env' is not defined" while evaluating.


With my code the error is:

ValueError: : "'datetime.datetime' object has no attribute 'user_tz'" while evaluating



Awatar
Odrzuć
Najlepsza odpowiedź

Hi,

Did you tried with env.user.tz without self ?

Thanks

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
lut 21
16361
1
paź 20
3393
2
sie 19
3762
0
wrz 16
4347
1
kwi 16
6711