summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Feyens <vfe@odoo.com>2019-09-14 11:42:45 +0000
committerRaphael Collet <rco@odoo.com>2019-11-18 12:25:05 +0000
commitce9fe1fcf680516e12d1e61a7305fdfb7ddbdc8f (patch)
treea270f9046e96b0d172e7def6e26d6c68c2df8144
parent57b999d40ad89a80dd4ae40433d928c0f0d57b09 (diff)
[IMP] * : remove company context key
-rw-r--r--addons/account/models/chart_template.py2
-rw-r--r--addons/digest/models/digest.py6
2 files changed, 4 insertions, 4 deletions
diff --git a/addons/account/models/chart_template.py b/addons/account/models/chart_template.py
index 7bcc2f6ded1..5d11e7195a1 100644
--- a/addons/account/models/chart_template.py
+++ b/addons/account/models/chart_template.py
@@ -172,7 +172,7 @@ class AccountChartTemplate(models.Model):
self.ensure_one()
# do not use `request.env` here, it can cause deadlocks
# Ensure everything is translated to the company's language, not the user's one.
- self = self.with_context(lang=company.partner_id.lang, company=company)
+ self = self.with_context(lang=company.partner_id.lang).with_company(company)
if not self.env.is_admin():
raise AccessError(_("Only administrators can load a chart of accounts"))
diff --git a/addons/digest/models/digest.py b/addons/digest/models/digest.py
index 950794d29b3..c8f49d8967f 100644
--- a/addons/digest/models/digest.py
+++ b/addons/digest/models/digest.py
@@ -56,7 +56,7 @@ class Digest(models.Model):
digest.available_fields = ', '.join(kpis_values_fields)
def _get_kpi_compute_parameters(self):
- return fields.Date.to_string(self._context.get('start_date')), fields.Date.to_string(self._context.get('end_date')), self._context.get('company')
+ return fields.Date.to_string(self._context.get('start_date')), fields.Date.to_string(self._context.get('end_date')), self.env.company
def _compute_kpi_res_users_connected_value(self):
for record in self:
@@ -105,8 +105,8 @@ class Digest(models.Model):
self.ensure_one()
res = {}
for tf_name, tf in self._compute_timeframes(company).items():
- digest = self.with_context(start_date=tf[0][0], end_date=tf[0][1], company=company).with_user(user)
- previous_digest = self.with_context(start_date=tf[1][0], end_date=tf[1][1], company=company).with_user(user)
+ digest = self.with_context(start_date=tf[0][0], end_date=tf[0][1]).with_user(user).with_company(company)
+ previous_digest = self.with_context(start_date=tf[1][0], end_date=tf[1][1]).with_user(user).with_company(company)
kpis = {}
for field_name, field in self._fields.items():
if field.type == 'boolean' and field_name.startswith(('kpi_', 'x_kpi_', 'x_studio_kpi_')) and self[field_name]: