diff --git a/sql_export_excel/__openerp__.py b/sql_export_excel/__manifest__.py similarity index 90% rename from sql_export_excel/__openerp__.py rename to sql_export_excel/__manifest__.py index c130eece7..237b2df70 100644 --- a/sql_export_excel/__openerp__.py +++ b/sql_export_excel/__manifest__.py @@ -1,10 +1,9 @@ -# -*- coding: utf-8 -*- # Copyright 2019 Akretion # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { 'name': 'SQL Export Excel', - 'version': '9.0.1.0.0', + 'version': '12.0.1.0.0', 'author': 'Akretion,Odoo Community Association (OCA)', 'website': 'http://github/oca/server-tools', 'license': 'AGPL-3', diff --git a/sql_export_excel/models/sql_export.py b/sql_export_excel/models/sql_export.py index bb1ea5e49..48a45cf90 100644 --- a/sql_export_excel/models/sql_export.py +++ b/sql_export_excel/models/sql_export.py @@ -1,9 +1,8 @@ -# -*- coding: utf-8 -*- # Copyright 2019 Akretion # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from openerp import api, exceptions, fields, models, _ -from cStringIO import StringIO +from io import BytesIO import logging import base64 _logger = logging.getLogger(__name__) @@ -78,7 +77,7 @@ class SqlExport(models.Model): # Case we insert data in an existing excel file. if self.attachment_id: datas = self.attachment_id.datas - infile = StringIO() + infile = BytesIO() infile.write(base64.b64decode(datas)) infile.seek(0) wb = openpyxl.load_workbook(filename=infile) @@ -100,7 +99,7 @@ class SqlExport(models.Model): for index, row in enumerate(res, row_position): for col, val in enumerate(row, col_position): ws.cell(row=index, column=col).value = val - output = StringIO() + output = BytesIO() wb.save(output) output.getvalue() output_datas = base64.b64encode(output.getvalue()) diff --git a/sql_export_excel/tests/__init__.py b/sql_export_excel/tests/__init__.py index 22c4421ab..6d89d7607 100644 --- a/sql_export_excel/tests/__init__.py +++ b/sql_export_excel/tests/__init__.py @@ -1,2 +1 @@ -# -*- coding: utf-8 -*- from . import test_sql_query_excel diff --git a/sql_export_excel/tests/test_sql_query_excel.py b/sql_export_excel/tests/test_sql_query_excel.py index a51423c67..b1433c55b 100644 --- a/sql_export_excel/tests/test_sql_query_excel.py +++ b/sql_export_excel/tests/test_sql_query_excel.py @@ -1,11 +1,10 @@ -# -*- coding: utf-8 -*- # Copyright (C) 2019 Akretion () # @author: Florian da Costa # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp.tests.common import TransactionCase +from odoo.tests.common import TransactionCase import base64 -from cStringIO import StringIO +from io import BytesIO import logging _logger = logging.getLogger(__name__) @@ -25,7 +24,7 @@ class TestExportSqlQueryExcel(TransactionCase): def get_workbook_from_query(self, wizard): wizard.export_sql() decoded_data = base64.b64decode(wizard.binary_file) - xlsx_file = StringIO(decoded_data) + xlsx_file = BytesIO(decoded_data) return openpyxl.load_workbook(xlsx_file) def test_excel_file_generation(self): @@ -63,7 +62,7 @@ class TestExportSqlQueryExcel(TransactionCase): ws2 = wb.create_sheet("data") ws2.cell(row=1, column=1, value='Partner Id') ws2.cell(row=1, column=2, value='Partner Name') - output = StringIO() + output = BytesIO() wb.save(output) data = output.getvalue()