[IMP] * : remove company context key

This commit is contained in:
Victor Feyens
2019-11-18 12:25:05 +00:00
committed by Raphael Collet
parent 57b999d40a
commit ce9fe1fcf6
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -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"))
+3 -3
View File
@@ -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]: