Skip to content

Commit

Permalink
[11.0]add support for inactive journals to account.financial.report b…
Browse files Browse the repository at this point in the history
…ased reports
  • Loading branch information
luc-demeyer committed Jul 26, 2020
1 parent 6c13751 commit 7669871
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion l10n_be_coa_multilang/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{
'name': 'Belgium - Multilingual Chart of Accounts (en/nl/fr)',
'version': '11.0.1.2.3',
'version': '11.0.1.2.4',
'license': 'AGPL-3',
'author': "Noviat",
'website': 'http://www.noviat.com',
Expand Down
23 changes: 19 additions & 4 deletions l10n_be_coa_multilang/wizards/account_common_report.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
# Copyright 2009-2018 Noviat.
# Copyright 2009-2020 Noviat.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, models
from odoo import api, fields, models


class AccountCommonReport(models.TransientModel):
_inherit = 'account.common.report'

journal_ids = fields.Many2many(
default=lambda self: self._default_journal_ids())

@api.model
def _default_journal_ids(self):
"""
include data from inactive journals by default
"""
res = self.env['account.journal'].with_context(
active_test=False).search([])
return res

def _build_contexts(self, data):
"""
No date_from for balance sheet if we select a fiscal year.
"""
result = super(AccountCommonReport, self)._build_contexts(data)
result = super()._build_contexts(data)
if self.date_range_id.type_id.fiscal_year:
module = __name__.split('addons.')[1].split('.')[0]
be_bs = self.env.ref(
Expand All @@ -22,7 +34,10 @@ def _build_contexts(self, data):

@api.multi
def check_report(self):
res = super(AccountCommonReport, self).check_report()
# include data from inactive journals
ctx = dict(self.env.context, active_test=False)
res = super(
AccountCommonReport, self.with_context(ctx)).check_report()
if self.date_range_id.type_id.fiscal_year:
module = __name__.split('addons.')[1].split('.')[0]
be_bs = self.env.ref(
Expand Down

0 comments on commit 7669871

Please sign in to comment.