Skip to content
Snippets Groups Projects
Commit a5a10e75 authored by Xavier Morel's avatar Xavier Morel
Browse files

[FIX] P3: file builtin removed

* replace with open()
* forbid file() builtin since reports-removal was merged
parent b86e5fa4
No related branches found
No related tags found
No related merge requests found
......@@ -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
-
......
......@@ -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)
......@@ -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()):
......
......@@ -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):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment