summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-07-05 16:23:47 +0200
committerChristophe Simonis <chs@odoo.com>2018-07-05 16:23:47 +0200
commit84210074e55d906ea3c36e3a79741f83c5a55215 (patch)
tree4e1b19abc8e9f587da5a605ed2aa5d00b535d29d /addons
parenta978a3647a8ed8a08311f56dcf2f3e04056052b8 (diff)
parentb06c09db604a580acc85eb75ce68f42880ba9b73 (diff)
[MERGE] forward port branch saas-15 up to b06c09db604
Diffstat (limited to 'addons')
-rw-r--r--addons/pos_sale/models/crm_team.py16
-rw-r--r--addons/project/__manifest__.py2
-rw-r--r--addons/sales_team/models/crm_team.py2
3 files changed, 12 insertions, 8 deletions
diff --git a/addons/pos_sale/models/crm_team.py b/addons/pos_sale/models/crm_team.py
index e11727e0a1d..590bc4759d4 100644
--- a/addons/pos_sale/models/crm_team.py
+++ b/addons/pos_sale/models/crm_team.py
@@ -3,6 +3,7 @@
from odoo import api, fields, models, _
from datetime import datetime
+import pytz
class CrmTeam(models.Model):
@@ -41,13 +42,16 @@ class CrmTeam(models.Model):
""" If the type of the sales team is point of sale ('pos'), the graph will display the sales data.
The override here is to get data from pos.order instead of sale.order.
"""
+ offset = datetime.now(pytz.timezone(self.env.user.tz or 'UTC')).utcoffset()
+ min_date = fields.Datetime.to_string(datetime.combine(start_date, datetime.min.time()) - offset)
+ max_date = fields.Datetime.to_string(datetime.combine(end_date, datetime.max.time()) - offset)
if self.team_type == 'pos':
result = []
if self.dashboard_graph_group_pos == 'pos':
order_data = self.env['report.pos.order'].read_group(
domain=[
- ('date', '>=', fields.Date.to_string(start_date)),
- ('date', '<=', fields.Datetime.to_string(datetime.combine(end_date, datetime.max.time()))),
+ ('date', '>=', min_date),
+ ('date', '<=', max_date),
('config_id', 'in', self.pos_config_ids.ids),
('state', 'in', ['paid', 'done', 'invoiced'])],
fields=['config_id', 'price_total'],
@@ -63,8 +67,8 @@ class CrmTeam(models.Model):
elif self.dashboard_graph_group_pos == 'user':
order_data = self.env['report.pos.order'].read_group(
domain=[
- ('date', '>=', fields.Date.to_string(start_date)),
- ('date', '<=', fields.Datetime.to_string(datetime.combine(end_date, datetime.max.time()))),
+ ('date', '>=', min_date),
+ ('date', '<=', max_date),
('config_id', 'in', self.pos_config_ids.ids),
('state', 'in', ['paid', 'done', 'invoiced'])],
fields=['user_id', 'price_total'],
@@ -78,8 +82,8 @@ class CrmTeam(models.Model):
# /!\ do not use en_US as it's not ISO-standard and does not match datetime's library
order_data = self.env['report.pos.order'].with_context(lang='en_GB').read_group(
domain=[
- ('date', '>=', fields.Date.to_string(start_date)),
- ('date', '<=', fields.Datetime.to_string(datetime.combine(end_date, datetime.max.time()))),
+ ('date', '>=', min_date),
+ ('date', '<=', max_date),
('config_id', 'in', self.pos_config_ids.ids),
('state', 'in', ['paid', 'done', 'invoiced'])],
fields=['date', 'price_total'],
diff --git a/addons/project/__manifest__.py b/addons/project/__manifest__.py
index 214588a81c8..a42fa6d7aaf 100644
--- a/addons/project/__manifest__.py
+++ b/addons/project/__manifest__.py
@@ -23,7 +23,6 @@
'data': [
'security/project_security.xml',
'security/ir.model.access.csv',
- 'data/project_data.xml',
'report/project_report_views.xml',
'views/project_views.xml',
'views/res_partner_views.xml',
@@ -33,6 +32,7 @@
'data/web_planner_data.xml',
'data/project_mail_template_data.xml',
'wizard/project_task_merge_wizard_views.xml',
+ 'data/project_data.xml',
],
'qweb': ['static/src/xml/project.xml'],
'demo': ['data/project_demo.xml'],
diff --git a/addons/sales_team/models/crm_team.py b/addons/sales_team/models/crm_team.py
index 4542116c47c..f3708fc5b10 100644
--- a/addons/sales_team/models/crm_team.py
+++ b/addons/sales_team/models/crm_team.py
@@ -209,7 +209,7 @@ class CrmTeam(models.Model):
self.ensure_one()
values = []
- today = date.today()
+ today = fields.Date.from_string(fields.Date.context_today(self))
start_date, end_date = self._graph_get_dates(today)
graph_data = self._graph_data(start_date, end_date)