Odoo Help


6 Answers

Anil R. Kesariya (AKE) India

--Anil R. Kesariya (AKE)--
| 8 7 10
Rajkot, India
--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

Upwork : https://www.upwork.com/fl/anilkesariya

Anil R. Kesariya (AKE) India
5/20/17, 2:42 AM


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.



Hilar AK Oman
5/20/17, 4:27 AM

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) India
5/20/17, 5:56 AM

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 Oman
5/22/17, 6:36 AM

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

Anil R. Kesariya (AKE) India
5/30/17, 12:18 AM

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

Dmitry Somov Canada
8/30/19, 3:02 PM

It has been discussed in the community for a while:
In my opinion there is a logic behind the default treatment of timezones in Odoo:
1) Transactions are recorded with UTC timestamp for all users (server time is UTC)
2) Transactions are displayed to users in their timezone (UTC +TZ delta)

1) For two users working in various timezones to have identical reports requires setting their time to UTC
2) Some transactions recorded same day (late hours) in Western timezones will be timestamped next day on server and will be shown in the reports for next day
3) Some transactions recorded same day (early hours) in Eastern timezones will be timestamped previous day on server and will be shown in the reports for previous day
4) Reports which do not take time as a parameter (only day) will be shown identical to all users. Some transactions from Western timezones day ends (local time) and Eastern timezones day starts (local time) won’t be shown.

Accountants should be aware of this behavior and should setup their policies respectively:
1) For the reports taking DAY AND TIME as parameters they should login under a UTC-USER
2) For the reports taking only DAY as a parameter they may login either under a LOCAL TIMEZONE USER or under a UTC-USER

Ask a Question
Keep Informed
2 follower(s)
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.

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now