From a5a10e75ab73af1dc45a48da9029bd246c1fc14b Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 9 May 2017 13:57:22 +0200 Subject: [PATCH] [FIX] P3: file builtin removed * replace with open() * forbid file() builtin since reports-removal was merged --- addons/account/test/account_report.yml | 4 ++-- addons/l10n_fr/test/l10n_fr_report.yml | 4 ++-- odoo/addons/base/ir/ir_actions_report.py | 2 +- odoo/addons/test_pylint/tests/test_pylint.py | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/addons/account/test/account_report.yml b/addons/account/test/account_report.yml index b3ac442aa81..24cefb19ced 100644 --- a/addons/account/test/account_report.yml +++ b/addons/account/test/account_report.yml @@ -17,7 +17,7 @@ from odoo import tools data, format = ref('account.report_invoice').render(ref('account.account_invoice_customer0')) if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'account-invoice.'+format), 'wb+').write(data) + open(os.path.join(tools.config['test_report_directory'], 'account-invoice.'+format), 'wb+').write(data) - In order to test the PDF reports defined on a partner, we will print the Overdue Report - @@ -26,7 +26,7 @@ from odoo import tools data, format = ref('account.report_overdue').render([ref('base.res_partner_1'),ref('base.res_partner_2'),ref('base.res_partner_12')]) if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'account-report_overdue.'+format), 'wb+').write(data) + open(os.path.join(tools.config['test_report_directory'], 'account-report_overdue.'+format), 'wb+').write(data) - Print the Aged Partner Balance Report - diff --git a/addons/l10n_fr/test/l10n_fr_report.yml b/addons/l10n_fr/test/l10n_fr_report.yml index 927d7d4f2c1..f0ce0e14b31 100644 --- a/addons/l10n_fr/test/l10n_fr_report.yml +++ b/addons/l10n_fr/test/l10n_fr_report.yml @@ -6,7 +6,7 @@ from odoo import tools data, format = self.env.ref('l10n_fr.report_l10nfrbilan').render([], data={'model':'account.move.line', 'form':{'fiscalyear_id': ref('account.data_fiscalyear')}}) if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'l10n_fr-bilan_report.'+format), 'wb+').write(data) + open(os.path.join(tools.config['test_report_directory'], 'l10n_fr-bilan_report.'+format), 'wb+').write(data) - In order to test the PDF reports defined on a l10n_fr, we will print a Compute Resultant Report for l10n_fr @@ -16,4 +16,4 @@ from odoo import tools data, format = self.env.ref('l10n_fr.report_l10nfrresultat').render([], data={'model':'account.move.line', 'form':{'fiscalyear_id': ref('account.data_fiscalyear')}}) if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'l10n_fr-compute_resultant_report.'+format), 'wb+').write(data) + open(os.path.join(tools.config['test_report_directory'], 'l10n_fr-compute_resultant_report.'+format), 'wb+').write(data) diff --git a/odoo/addons/base/ir/ir_actions_report.py b/odoo/addons/base/ir/ir_actions_report.py index 05fe96e99f3..466f4960300 100644 --- a/odoo/addons/base/ir/ir_actions_report.py +++ b/odoo/addons/base/ir/ir_actions_report.py @@ -82,7 +82,7 @@ def _merge_pdf(documents): writer = PdfFileWriter() streams = [] # We have to close the streams *after* PdfFilWriter's call to write() for document in documents: - pdfreport = file(document, 'rb') + pdfreport = open(document, 'rb') streams.append(pdfreport) reader = PdfFileReader(pdfreport) for page in range(0, reader.getNumPages()): diff --git a/odoo/addons/test_pylint/tests/test_pylint.py b/odoo/addons/test_pylint/tests/test_pylint.py index f2be4771d4b..0def4516dc2 100644 --- a/odoo/addons/test_pylint/tests/test_pylint.py +++ b/odoo/addons/test_pylint/tests/test_pylint.py @@ -59,9 +59,9 @@ class TestPyLint(TransactionCase): 'map', 'filter', 'zip', - # TODO: enable once report has been removed - # 'file', - # 'reduce', + + 'file', + 'reduce', ] def _skip_test(self, reason):