Skip to content

Commit

Permalink
Default to company_id when company_ids is empty.
Browse files Browse the repository at this point in the history
Remove migration script that is not necessary anymore.
  • Loading branch information
sbidoul committed Oct 12, 2017
1 parent 92b0bea commit 1dbec4e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 25 deletions.
5 changes: 0 additions & 5 deletions mis_builder/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@
'date_range', # OCA/server-tools
'web_widget_color', # OCA/web
],
'external_dependencies': {
'python': [
'openupgradelib',
],
},
'data': [
'wizard/mis_builder_dashboard.xml',
'views/mis_report.xml',
Expand Down
13 changes: 0 additions & 13 deletions mis_builder/migrations/10.0.3.1.0/post-migration.py

This file was deleted.

13 changes: 6 additions & 7 deletions mis_builder/models/mis_report_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,11 +406,9 @@ def _default_company_id(self):
@api.onchange('company_id', 'multi_company')
def _onchange_company(self):
if self.company_id and self.multi_company:
self.company_ids = self.env['res.company'].search(
['|', ('id', '=', self.company_id.id),
('parent_id', 'child_of', self.company_id.id)
]
)
self.company_ids = self.env['res.company'].search([
('id', 'child_of', self.company_id.id),
])
else:
self.company_ids = self.company_id

Expand Down Expand Up @@ -621,7 +619,8 @@ def _compute_matrix(self):
is guaranteed to be the id of the mis.report.instance.period.
"""
self.ensure_one()
aep = self.report_id._prepare_aep(self.company_ids, self.currency_id)
aep = self.report_id._prepare_aep(
self.company_ids or self.company_id, self.currency_id)
kpi_matrix = self.report_id.prepare_kpi_matrix()
for period in self.period_ids:
description = None
Expand Down Expand Up @@ -652,7 +651,7 @@ def drilldown(self, arg):
account_id = arg.get('account_id')
if period_id and expr and AEP.has_account_var(expr):
period = self.env['mis.report.instance.period'].browse(period_id)
aep = AEP(self.company_ids, self.currency_id)
aep = AEP(self.company_ids or self.company_id, self.currency_id)
aep.parse_expr(expr)
aep.done_parsing()
domain = aep.get_aml_domain_for_expr(
Expand Down

0 comments on commit 1dbec4e

Please sign in to comment.