summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-07-05 15:35:24 +0200
committerChristophe Simonis <chs@odoo.com>2018-07-05 15:35:24 +0200
commitb06c09db604a580acc85eb75ce68f42880ba9b73 (patch)
tree11f47d94a592d8a1ebebc3e3355cfc617821d3f9 /addons
parentce84bacd720bb2cde32ff82b63d19652f452df61 (diff)
parent92e5da6b8fdc6084edd863a5e02a8cd9bd33512c (diff)
[MERGE] forward port branch saas-14 up to 92e5da6b8fd
Diffstat (limited to 'addons')
-rw-r--r--addons/mrp/models/stock_move.py2
-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
4 files changed, 13 insertions, 9 deletions
diff --git a/addons/mrp/models/stock_move.py b/addons/mrp/models/stock_move.py
index 0c6f50cfc52..982995a9e1f 100644
--- a/addons/mrp/models/stock_move.py
+++ b/addons/mrp/models/stock_move.py
@@ -117,7 +117,7 @@ class StockMove(models.Model):
@api.depends('move_lot_ids', 'move_lot_ids.quantity_done', 'quantity_done_store')
def _qty_done_compute(self):
for move in self:
- if move.has_tracking != 'none':
+ if move.has_tracking != 'none' or move.sudo().move_lot_ids.mapped('lot_id'):
move.quantity_done = sum(move.move_lot_ids.filtered(lambda x: x.done_wo).mapped('quantity_done')) #TODO: change with active_move_lot_ids?
else:
move.quantity_done = move.quantity_done_store
diff --git a/addons/pos_sale/models/crm_team.py b/addons/pos_sale/models/crm_team.py
index 54eed6c160b..341e275a791 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 1b8088578a7..f13f9ef7a6e 100644
--- a/addons/project/__manifest__.py
+++ b/addons/project/__manifest__.py
@@ -36,7 +36,6 @@ Dashboard / Reports for Project Management will include:
'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',
@@ -46,6 +45,7 @@ Dashboard / Reports for Project Management will include:
'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 691da68a6f3..a74205dfa7a 100644
--- a/addons/sales_team/models/crm_team.py
+++ b/addons/sales_team/models/crm_team.py
@@ -177,7 +177,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)