[FIX] account, analytic: remove company_ids context key mechanism

This commit is contained in:
Victor Feyens
2019-11-18 12:25:05 +00:00
committed by Raphael Collet
parent d52f8ce8b0
commit 37b1689be7
2 changed files with 8 additions and 6 deletions
+4 -3
View File
@@ -3810,9 +3810,10 @@ class AccountMoveLine(models.Model):
if context.get('company_id'):
domain += [('company_id', '=', context['company_id'])]
if 'company_ids' in context:
domain += [('company_id', 'in', context['company_ids'])]
elif context.get('allowed_company_ids'):
domain += [('company_id', 'in', self.env.companies.ids)]
else:
domain += [('company_id', '=', self.env.company.id)]
if context.get('reconcile_date'):
domain += ['|', ('reconciled', '=', False), '|', ('matched_debit_ids.max_date', '>', context['reconcile_date']), ('matched_credit_ids.max_date', '>', context['reconcile_date'])]
+4 -3
View File
@@ -82,7 +82,10 @@ class AccountAnalyticAccount(models.Model):
def _compute_debit_credit_balance(self):
Curr = self.env['res.currency']
analytic_line_obj = self.env['account.analytic.line']
domain = [('account_id', 'in', self.ids)]
domain = [
('account_id', 'in', self.ids)
('company_id', 'in', [False] + self.env.companies.ids)
]
if self._context.get('from_date', False):
domain.append(('date', '>=', self._context['from_date']))
if self._context.get('to_date', False):
@@ -90,8 +93,6 @@ class AccountAnalyticAccount(models.Model):
if self._context.get('tag_ids'):
tag_domain = expression.OR([[('tag_ids', 'in', [tag])] for tag in self._context['tag_ids']])
domain = expression.AND([domain, tag_domain])
if self._context.get('company_ids'):
domain.append(('company_id', 'in', self._context['company_ids']))
user_currency = self.env.company.currency_id
credit_groups = analytic_line_obj.read_group(