Odoo Hilfe

2

0
1 Answer
4
Avatar

Anil R. Kesariya (AKE)

--Anil R. Kesariya (AKE)--
6589
| 8 7 10
Rajkot, Indien
--Anil R. Kesariya (AKE)--

Odoo Techno Functional Expert

* Engaged with odoo since May - 2012.

* Customise existing module or develop new module base on customer requirement.

* Played key developer role in many past and running projects.

* Expert in requirement gathering of business and transforming requirement into odoo platform.

* Major expertise in core modules, database, report development and theme development.

* Integration expert.


Linkedin  : https://in.linkedin.com/in/anil-kesariya-97b20a66


Anil R. Kesariya (AKE)
20.05.17, 02:42

Hilar,

Yes, system (database) captures time in UTC format just because odoo allows users to login from anywhere in the world and every person belongs to different country have different timezone.

So, odoo evaluates the time based on the logged in user's timezone. If you don't know about how to set the timezone in users, you can go user's form either from preferences or from setting open the particular user from which you are trying to logged in. system (odoo) will display time according to your (user's) set timezone.

Hope this answer may help you to more clear about timezone.

Regards,

Anil.

4 Comments
Hilar AK
20.05.17, 04:27

I know This and I mentioned that in question, thats only applicable on which user is using the orm methods, what is the case of public, and if you are fetching datas through query? Next case is for portal users, some times you have to fetch data as SUPERUSER and you can display data as in format of SUPERUSER TZ

Anil R. Kesariya (AKE)
20.05.17, 05:56

If you want to display the datetime info on website, you need to convert the manually in localise format. you can pytz lib to customise this.

This e.g. may help you.

from datetime import datetime

import pytz

user_tz = self.env.user.tz or pytz.utc

local = pytz.timezone(user_tz)

display_date_result = datetime.strftime(pytz.utc.localize(datetime.strptime(your_date_or_datetime_info, DEFAULT_SERVER_DATETIME_FORMAT)).astimezone(local),"%d/%m/%Y %H:%M%S")

try this.

Hilar AK
22.05.17, 06:36

orm methods returns datetime data according to the users zone. Other cases I used momentJs. above method is also good

Anil R. Kesariya (AKE)
30.05.17, 00:18

@hilar, that's great if you can use momentJs.

Fragen Sie
Writer
Keep Informed
1 Verfolger
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now