Skip to content

Commit

Permalink
Merge remote-tracking branch 'odoo/7.0' into 7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
OCA-git-bot committed Feb 24, 2016
2 parents fd6a3d6 + 9f0120d commit c975afe
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion addons/point_of_sale/report/pos_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
#
##############################################################################

import datetime
import pytz
import time
from openerp import tools
from openerp.report import report_sxw

class pos_details(report_sxw.rml_parse):
Expand All @@ -44,7 +47,22 @@ def _pos_sales_details(self, form):
result = {}
user_ids = form['user_ids'] or self._get_all_users()
company_id = user_obj.browse(self.cr, self.uid, self.uid).company_id.id
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)])
user = self.pool['res.users'].browse(self.cr, self.uid, self.uid) or self.localcontext.get('tz') or 'UTC'
tz_name = user.tz
user_tz = pytz.timezone(tz_name)
between_dates = {}
for date_field, delta in {'date_start': {'days': 0}, 'date_end': {'days': 1}}.items():
timestamp = datetime.datetime.strptime(form[date_field] + ' 00:00:00', tools.DEFAULT_SERVER_DATETIME_FORMAT) + datetime.timedelta(**delta)
timestamp = user_tz.localize(timestamp).astimezone(pytz.utc)
between_dates[date_field] = timestamp.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT)

pos_ids = pos_obj.search(self.cr, self.uid, [
('date_order', '>=', between_dates['date_start']),
('date_order', '<', between_dates['date_end']),
('user_id', 'in', user_ids),
('state', 'in', ['done', 'paid', 'invoiced']),
('company_id', '=', company_id)
])
for pos in pos_obj.browse(self.cr, self.uid, pos_ids):
for pol in pos.lines:
result = {
Expand Down

0 comments on commit c975afe

Please sign in to comment.