openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #23764
[Bug 1130812] Re: OpenERP Server not correctly forcing UTC (Ubuntu)
*** This bug is a duplicate of bug 1078200 ***
https://bugs.launchpad.net/bugs/1078200
** This bug has been marked a duplicate of bug 1078200
[Trunk,6.1] Timezone ERROR in Scheduled Actions
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/1130812
Title:
OpenERP Server not correctly forcing UTC (Ubuntu)
Status in OpenERP Server:
New
Bug description:
With OpenERP 6.1, the server should operate in UTC. In my
understanding, this means when I call
datetime.datetime.now() OR time it should give me a time in UTC. In
all of the OpenERP installations I have worked with, I am sorry to say
it does not work well with time. Some forms/views have the right time
while others do not. For instance, a new sale order will have the
correct time, but the picking will have a bogus time for field 'date'
and 'date_done'.
Lets examine the code,
in stock.py addons 6.1 line 502, there is a default for field 'date'
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
If you print this date it is the customers current timezone NOT UTC time.
Continuing,
line 850:
'date_done': time.strftime('%Y-%m-%d %H:%M:%S')
This time is also the customers timezone. The effect is strange. The
time is stored in the database as the customers timezone, but the
front end forwards the time to UTC time, however since the time was
already delta the time is wrong. The time displayed is not the correct
time. To remedy this issue, I replaced all instances of
time with datetime.datetime.utcnow()
This stores the time correctly as UTC time, and the front end displays
the correct time. This is one example, The addons modules are littered
with instances of time or datetime.now(). IMO the implementation of
UTC time is not correct.
Additionally, the application needs to be able to detect when the time
is not calculated correctly and report this to the user, Especially in
cases of custom modules. The Server should also ensure the environment
is in UTC time, which clearly is not always the case.
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/1130812/+subscriptions
References