From 472b8d83ff0676d054c4025de5cbb44c42ab4750 Mon Sep 17 00:00:00 2001 From: luc-demeyer Date: Sun, 12 Mar 2017 08:28:27 +0100 Subject: [PATCH] [DEL] fy fix since merged upstream --- .../wizard/__init__.py | 3 - .../wizard/account_common_report_fix.py | 121 ------------------ account_journal_report_xls/wizard/__init__.py | 1 - .../wizard/account_common_report_fix.py | 65 ---------- 4 files changed, 190 deletions(-) delete mode 100644 account_financial_report_webkit/wizard/account_common_report_fix.py delete mode 100644 account_journal_report_xls/wizard/account_common_report_fix.py diff --git a/account_financial_report_webkit/wizard/__init__.py b/account_financial_report_webkit/wizard/__init__.py index cf2b2645..2fd101b2 100644 --- a/account_financial_report_webkit/wizard/__init__.py +++ b/account_financial_report_webkit/wizard/__init__.py @@ -8,6 +8,3 @@ from . import open_invoices_wizard from . import aged_open_invoices_wizard from . import print_journal from . import aged_partner_balance_wizard -# uncomment import infra when running Odoo without -# PR https://github.com/odoo/odoo/pull/14891 -# from . import account_common_report_fix diff --git a/account_financial_report_webkit/wizard/account_common_report_fix.py b/account_financial_report_webkit/wizard/account_common_report_fix.py deleted file mode 100644 index 285faabe..00000000 --- a/account_financial_report_webkit/wizard/account_common_report_fix.py +++ /dev/null @@ -1,121 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2009-2017 Noviat. -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -""" -Bypass of bug in Odoo: -The financial reports do not work on first and last day of the Fiscal Year. -This fix can be removed after merge of -PR https://github.com/odoo/odoo/pull/14891. -""" -import logging -import time -from openerp import api, fields, models -_logger = logging.getLogger(__name__) - - -class AccountCommonReportFix(object): - - @api.model - def _default_fiscalyear_id(self): - _logger.debug( - '%s, fix cf. PR https://github.com/odoo/odoo/pull/14891', - self._name) - fy_id = super(AccountCommonReportFix, self)._get_fiscalyear() - if fy_id: - return self.env['account.fiscalyear'].browse(fy_id) - - now = time.strftime('%Y-%m-%d') - ids = self._context.get('active_ids', []) - if ids and self._context.get('active_model') == 'account.account': - company = self.env['account.account'].browse(ids[0]) - else: # use current company id - company = self.env.user.company_id - domain = [('company_id', '=', company.id), - ('date_start', '<=', now), ('date_stop', '>=', now)] - return self.env['account.fiscalyear'].search(domain, limit=1) - - def onchange_chart_id(self, cr, uid, ids, - chart_account_id=False, context=None): - _logger.debug( - '%s, fix cf. PR https://github.com/odoo/odoo/pull/14891', - self._name) - res = super(AccountCommonReportFix, self).onchange_chart_id( - cr, uid, ids, chart_account_id=chart_account_id, context=context) - if not res.get('fiscalyear_id'): - if chart_account_id: - company_id = self.pool['account.account'].browse( - cr, uid, chart_account_id, context=context).company_id.id - now = time.strftime('%Y-%m-%d') - domain = [('company_id', '=', company_id), - ('date_start', '<=', now), ('date_stop', '>=', now)] - fiscalyears = self.pool['account.fiscalyear'].search( - cr, uid, domain, limit=1) - res['value'] = { - 'company_id': company_id, - 'fiscalyear_id': fiscalyears and fiscalyears[0] or False, - } - return res - - -class AccountReportGeneralLedgerWizard(AccountCommonReportFix, - models.TransientModel): - _inherit = 'general.ledger.webkit' - - fiscalyear_id = fields.Many2one( - default=lambda self: self._default_fiscalyear_id()) - - -class AgedOpenInvoice(AccountCommonReportFix, - models.TransientModel): - _inherit = 'aged.open.invoices.webkit' - - fiscalyear_id = fields.Many2one( - default=lambda self: self._default_fiscalyear_id()) - - -class AccountAgedTrialBalance(AccountCommonReportFix, - models.TransientModel): - _inherit = 'account.aged.trial.balance.webkit' - - # no fiscalyear_id in this one since the module has - # its own method for this. - - -class AccountReportOpenInvoicesWizard(AccountCommonReportFix, - models.TransientModel): - _inherit = 'open.invoices.webkit' - - fiscalyear_id = fields.Many2one( - default=lambda self: self._default_fiscalyear_id()) - - -class AccountPartnerBalanceWizard(AccountCommonReportFix, - models.TransientModel): - _inherit = 'partner.balance.webkit' - - fiscalyear_id = fields.Many2one( - default=lambda self: self._default_fiscalyear_id()) - - -class AccountReportPartnersLedgerWizard(AccountCommonReportFix, - models.TransientModel): - _inherit = 'partners.ledger.webkit' - - fiscalyear_id = fields.Many2one( - default=lambda self: self._default_fiscalyear_id()) - - -class AccountReportPrintJournalWizard(AccountCommonReportFix, - models.TransientModel): - _inherit = 'print.journal.webkit' - - fiscalyear_id = fields.Many2one( - default=lambda self: self._default_fiscalyear_id()) - - -class AccountTrialBalanceWizard(AccountCommonReportFix, - models.TransientModel): - _inherit = 'trial.balance.webkit' - - fiscalyear_id = fields.Many2one( - default=lambda self: self._default_fiscalyear_id()) diff --git a/account_journal_report_xls/wizard/__init__.py b/account_journal_report_xls/wizard/__init__.py index 347f6753..29d7eb8a 100644 --- a/account_journal_report_xls/wizard/__init__.py +++ b/account_journal_report_xls/wizard/__init__.py @@ -1,3 +1,2 @@ # -*- coding: utf-8 -*- from . import print_journal_wizard -from . import account_common_report_fix diff --git a/account_journal_report_xls/wizard/account_common_report_fix.py b/account_journal_report_xls/wizard/account_common_report_fix.py deleted file mode 100644 index e777061d..00000000 --- a/account_journal_report_xls/wizard/account_common_report_fix.py +++ /dev/null @@ -1,65 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2009-2017 Noviat. -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -""" -Bypass of bug in Odoo: -The financial reports do not work on first and last day of the Fiscal Year. -This fix can be removed after merge of -PR https://github.com/odoo/odoo/pull/14891. -""" -import logging -import time -from openerp import api, fields, models -_logger = logging.getLogger(__name__) - - -class AccountCommonReportFix(object): - - @api.model - def _default_fiscalyear_id(self): - _logger.debug( - '%s, fix cf. PR https://github.com/odoo/odoo/pull/14891', - self._name) - fy_id = super(AccountCommonReportFix, self)._get_fiscalyear() - if fy_id: - return self.env['account.fiscalyear'].browse(fy_id) - - now = time.strftime('%Y-%m-%d') - ids = self._context.get('active_ids', []) - if ids and self._context.get('active_model') == 'account.account': - company = self.env['account.account'].browse(ids[0]) - else: # use current company id - company = self.env.user.company_id - domain = [('company_id', '=', company.id), - ('date_start', '<=', now), ('date_stop', '>=', now)] - return self.env['account.fiscalyear'].search(domain, limit=1) - - def onchange_chart_id(self, cr, uid, ids, - chart_account_id=False, context=None): - _logger.debug( - '%s, fix cf. PR https://github.com/odoo/odoo/pull/14891', - self._name) - res = super(AccountCommonReportFix, self).onchange_chart_id( - cr, uid, ids, chart_account_id=chart_account_id, context=context) - if not res.get('fiscalyear_id'): - if chart_account_id: - company_id = self.pool['account.account'].browse( - cr, uid, chart_account_id, context=context).company_id.id - now = time.strftime('%Y-%m-%d') - domain = [('company_id', '=', company_id), - ('date_start', '<=', now), ('date_stop', '>=', now)] - fiscalyears = self.pool['account.fiscalyear'].search( - cr, uid, domain, limit=1) - res['value'] = { - 'company_id': company_id, - 'fiscalyear_id': fiscalyears and fiscalyears[0] or False, - } - return res - - -class AccountPrintJournalXls(AccountCommonReportFix, - models.TransientModel): - _inherit = 'account.print.journal.xls' - - fiscalyear_id = fields.Many2one( - default=lambda self: self._default_fiscalyear_id())