From 68448cfa749d515a99aa08a418871078e80b94b1 Mon Sep 17 00:00:00 2001 From: Florian Date: Tue, 3 Sep 2019 11:37:56 +0200 Subject: [PATCH] Small fixes for v12/python3 standard Co-Authored-By: David Beal --- sql_export/models/sql_export.py | 2 +- sql_export/wizard/wizard_file.py | 6 +++--- sql_export_excel/models/sql_export.py | 6 +++--- sql_export_excel/tests/test_sql_query_excel.py | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sql_export/models/sql_export.py b/sql_export/models/sql_export.py index 5463a328a..15a0bffea 100644 --- a/sql_export/models/sql_export.py +++ b/sql_export/models/sql_export.py @@ -59,7 +59,7 @@ class SqlExport(models.Model): if self.file_format == 'csv': return 'csv' - def csv_get_datas_from_query(self, variable_dict): + def csv_get_data_from_query(self, variable_dict): self.ensure_one() # Execute Request res = self._execute_sql_request( diff --git a/sql_export/wizard/wizard_file.py b/sql_export/wizard/wizard_file.py index 52614f9e1..a0439d1e4 100644 --- a/sql_export/wizard/wizard_file.py +++ b/sql_export/wizard/wizard_file.py @@ -70,11 +70,11 @@ class SqlFileWizard(models.TransientModel): # Call different method depending on file_type since the logic will be # different - method_name = '%s_get_datas_from_query' % sql_export.file_format - datas = getattr(sql_export, method_name)(variable_dict) + method_name = '%s_get_data_from_query' % sql_export.file_format + data = getattr(sql_export, method_name)(variable_dict) extension = sql_export._get_file_extension() self.write({ - 'binary_file': datas, + 'binary_file': data, 'file_name': '%(name)s_%(date)s.%(extension)s' % { 'name': sql_export.name, 'date': date, 'extension': extension} }) diff --git a/sql_export_excel/models/sql_export.py b/sql_export_excel/models/sql_export.py index 48a45cf90..3479481e3 100644 --- a/sql_export_excel/models/sql_export.py +++ b/sql_export_excel/models/sql_export.py @@ -1,7 +1,7 @@ # Copyright 2019 Akretion # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from openerp import api, exceptions, fields, models, _ +from odoo import api, exceptions, fields, models, _ from io import BytesIO import logging import base64 @@ -67,10 +67,10 @@ class SqlExport(models.Model): if self.file_format == 'excel': return 'xlsx' else: - return super(SqlExport, self)._get_file_extension() + return super()._get_file_extension() @api.multi - def excel_get_datas_from_query(self, variable_dict): + def excel_get_data_from_query(self, variable_dict): self.ensure_one() res = self._execute_sql_request( params=variable_dict, mode='fetchall', header=self.header) diff --git a/sql_export_excel/tests/test_sql_query_excel.py b/sql_export_excel/tests/test_sql_query_excel.py index b1433c55b..5711ccb7c 100644 --- a/sql_export_excel/tests/test_sql_query_excel.py +++ b/sql_export_excel/tests/test_sql_query_excel.py @@ -18,7 +18,7 @@ except ImportError: class TestExportSqlQueryExcel(TransactionCase): def setUp(self): - super(TestExportSqlQueryExcel, self).setUp() + super().setUp() self.wizard_obj = self.env['sql.file.wizard'] def get_workbook_from_query(self, wizard):