summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Morel <xmo@odoo.com>2017-05-09 13:57:22 +0200
committerXavier Morel <xmo@odoo.com>2017-05-12 09:27:17 +0200
commita5a10e75ab73af1dc45a48da9029bd246c1fc14b (patch)
treed97fb264c79aff28702b2d652ff4e4c43f16eccf
parentb86e5fa4778f067031a935c307164da5106101d5 (diff)
[FIX] P3: file builtin removed
* replace with open() * forbid file() builtin since reports-removal was merged
-rw-r--r--addons/account/test/account_report.yml4
-rw-r--r--addons/l10n_fr/test/l10n_fr_report.yml4
-rw-r--r--odoo/addons/base/ir/ir_actions_report.py2
-rw-r--r--odoo/addons/test_pylint/tests/test_pylint.py6
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):