summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Feyens <vfe@odoo.com>2019-10-14 13:15:22 +0000
committerRaphael Collet <rco@odoo.com>2019-11-18 12:25:05 +0000
commit37b1689be7585e72eca2fce68fa70cfe45e314a0 (patch)
treee7ed71667ad1aece6db47742a71289434c8c5654
parentd52f8ce8b030159f05bacb7d07ed042b862274dd (diff)
[FIX] account, analytic: remove company_ids context key mechanism
-rw-r--r--addons/account/models/account_move.py7
-rw-r--r--addons/analytic/models/analytic_account.py7
2 files changed, 8 insertions, 6 deletions
diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py
index fb1fbea2b70..bea32a8313f 100644
--- a/addons/account/models/account_move.py
+++ b/addons/account/models/account_move.py
@@ -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'])]
diff --git a/addons/analytic/models/analytic_account.py b/addons/analytic/models/analytic_account.py
index 286ff4a66f5..d6945cfcda4 100644
--- a/addons/analytic/models/analytic_account.py
+++ b/addons/analytic/models/analytic_account.py
@@ -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(