Odoo Help

Welcome!

This community 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.

1

How to fix the timezone issue in sale details report?

By
JC
on 5/4/15, 9:12 AM 483 views

My location is at UTC + 8,  when I sell products in POS before 8am KUL time the sale detail report will show them as yesterday records, how to fix this?

The time zone depend on location of server and time set on server, check that may help you.

sameer alhwety
on 5/4/15, 9:50 AM
2

JC

--JC--
807
| 5 1 8
Kuala Lumpur, Malaysia
--JC--

 

JC
On 5/14/15, 9:22 AM

This is a serious issue, unfortunately odoo and it's support don't bother much, raised a ticket to them, took me for a ride by incompetent support,  then ask to close the ticket.

Some smart guy from the community suggested the following link and it took me another ride.  But it may help you:-

https://github.com/odoo/odoo/pull/2914  

https://github.com/odoo/odoo/pull/2776

https://github.com/odoo/odoo/pull/2915 


If you really want an easy answer, this was what I changed to make it work, it make look stupid.

Edit  addons/point_of_sale/report/pos_details.py

add 

import datetime

look for the following line

pos_ids = pos_obj.search(self.cr, self.uid, [('date_order','>=',form['date_start'] + ' 00:00:00'),('date_order','<=',form['date_end'] + ' 23:59:59'),('user_id','in',user_ids),('state','in',['done','paid','invoiced']),('company_id','=',company_id)])
 

Change it to 

pos_ids = pos_obj.search(self.cr, self.uid, [('date_order','>=', (datetime.datetime.strptime( (form['date_start'] + ' 00:00:00'), "%Y-%m-%d %H:%M:%S") - datetime.timedelta(hours=8)).strftime("%Y-%m-%d %H:%M:%S") ),('date_order','<=',form['date_end'] + ' 15:59:59'),('user_id','in',user_ids),('state','in',['done','paid','invoiced']),('company_id','=',company_id)])


Take note for the following, since my location is UTC+8 , you need to change it according to you own number.

datetime.timedelta(hours=8)

form['date_end'] + ' 15:59:59' 

God knows how many more I need to change. I just hope it can be fixed it at the core.


Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 5/4/15, 9:12 AM
Seen: 483 times
Last updated: 5/14/15, 9:23 AM