From 30d63419c887310a7924e18c4238332a2ce7252f Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Sun, 28 Jul 2019 12:12:02 +0200 Subject: [PATCH 01/34] Add sql_export_excel --- sql_export_excel/README.rst | 47 ++++++++ sql_export_excel/__init__.py | 1 + sql_export_excel/__openerp__.py | 20 ++++ sql_export_excel/models/__init__.py | 1 + sql_export_excel/models/sql_export.py | 108 ++++++++++++++++++ sql_export_excel/readme/CONFIGURE.rst | 4 + sql_export_excel/readme/CONTRIBUTORS.rst | 1 + sql_export_excel/readme/DESCRIPTION.rst | 4 + sql_export_excel/tests/__init__.py | 2 + .../tests/test_sql_query_excel.py | 108 ++++++++++++++++++ sql_export_excel/views/sql_export_view.xml | 21 ++++ 11 files changed, 317 insertions(+) create mode 100644 sql_export_excel/README.rst create mode 100644 sql_export_excel/__init__.py create mode 100644 sql_export_excel/__openerp__.py create mode 100644 sql_export_excel/models/__init__.py create mode 100644 sql_export_excel/models/sql_export.py create mode 100644 sql_export_excel/readme/CONFIGURE.rst create mode 100644 sql_export_excel/readme/CONTRIBUTORS.rst create mode 100644 sql_export_excel/readme/DESCRIPTION.rst create mode 100644 sql_export_excel/tests/__init__.py create mode 100644 sql_export_excel/tests/test_sql_query_excel.py create mode 100644 sql_export_excel/views/sql_export_view.xml diff --git a/sql_export_excel/README.rst b/sql_export_excel/README.rst new file mode 100644 index 0000000000..5fb7bb10cb --- /dev/null +++ b/sql_export_excel/README.rst @@ -0,0 +1,47 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License: AGPL-3 + +SQL Export Excel +================ + +Add the possibility to extract data from a sql query toward an excel file. +It is also possible to provide an template excel file for a query. In this case, +the data will be inserted in the specified sheet of the provided excel file. This +is usefull when doing a lot of calculation in excel and the data is coming from Odoo. + +Known issues / Roadmap +====================== + +* It was designed to work with xlsx files only, xls format is not supported. + + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smash it by providing detailed and welcomed feedback. + +Credits +======= + +Contributors +------------ + +* Florian da Costa + +Maintainer +---------- + +.. image:: http://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: http://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit http://odoo-community.org. diff --git a/sql_export_excel/__init__.py b/sql_export_excel/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/sql_export_excel/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/sql_export_excel/__openerp__.py b/sql_export_excel/__openerp__.py new file mode 100644 index 0000000000..c130eece75 --- /dev/null +++ b/sql_export_excel/__openerp__.py @@ -0,0 +1,20 @@ +# -*- 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', + 'author': 'Akretion,Odoo Community Association (OCA)', + 'website': 'http://github/oca/server-tools', + 'license': 'AGPL-3', + 'category': 'Generic Modules/Others', + 'summary': 'Allow to export a sql query to an excel file.', + 'depends': [ + 'sql_export', + ], + 'data': [ + 'views/sql_export_view.xml', + ], + 'installable': True, + } diff --git a/sql_export_excel/models/__init__.py b/sql_export_excel/models/__init__.py new file mode 100644 index 0000000000..0144620622 --- /dev/null +++ b/sql_export_excel/models/__init__.py @@ -0,0 +1 @@ +from . import sql_export diff --git a/sql_export_excel/models/sql_export.py b/sql_export_excel/models/sql_export.py new file mode 100644 index 0000000000..bb1ea5e49b --- /dev/null +++ b/sql_export_excel/models/sql_export.py @@ -0,0 +1,108 @@ +# -*- 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 +import logging +import base64 +_logger = logging.getLogger(__name__) + +try: + import openpyxl +except ImportError: + _logger.debug('Can not import openpyxl') + + +class SqlExport(models.Model): + _inherit = 'sql.export' + + file_format = fields.Selection( + selection_add=[('excel', 'Excel')]) + header = fields.Boolean( + default=True, + help="Indicate if the header should be exported to the file.") + attachment_id = fields.Many2one( + 'ir.attachment', string='Excel Template', + help="If you configure an excel file (in xlsx format) here, the " + "result of the query will be injected in it.\nIt is usefull to " + "feed data in a excel file pre-configured with calculation") + sheet_position = fields.Integer( + default=1, + help="Indicate the sheet's position of the excel template where the " + "result of the sql query should be injected.") + row_position = fields.Integer( + default=1, + help="Indicate from which row the result of the query should be " + "injected.") + col_position = fields.Integer( + string="Column Position", + default=1, + help="Indicate from which column the result of the query should be " + "injected.") + + @api.constrains('sheet_position') + def check_sheet_position(self): + for export in self: + if export.sheet_position < 1: + raise exceptions.ValidationError( + _("The sheet position can't be less than 1.")) + + @api.constrains('row_position') + def check_row_position(self): + for export in self: + if export.row_position < 1: + raise exceptions.ValidationError( + _("The row position can't be less than 1.")) + + @api.constrains('col_position') + def check_column_position(self): + for export in self: + if export.col_position < 1: + raise exceptions.ValidationError( + _("The column position can't be less than 1.")) + + @api.multi + def _get_file_extension(self): + self.ensure_one() + if self.file_format == 'excel': + return 'xlsx' + else: + return super(SqlExport, self)._get_file_extension() + + @api.multi + def excel_get_datas_from_query(self, variable_dict): + self.ensure_one() + res = self._execute_sql_request( + params=variable_dict, mode='fetchall', header=self.header) + # Case we insert data in an existing excel file. + if self.attachment_id: + datas = self.attachment_id.datas + infile = StringIO() + infile.write(base64.b64decode(datas)) + infile.seek(0) + wb = openpyxl.load_workbook(filename=infile) + sheets = wb.worksheets + try: + ws = sheets[self.sheet_position - 1] + except IndexError: + raise exceptions.ValidationError( + _("The Excel Template file contains less than %s sheets " + "Please, adjust the Sheet Position parameter.")) + row_position = self.row_position or 1 + col_position = self.col_position or 1 + # Case of excel file creation + else: + wb = openpyxl.Workbook() + ws = wb.active + row_position = 1 + col_position = 1 + 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() + wb.save(output) + output.getvalue() + output_datas = base64.b64encode(output.getvalue()) + output.close() + return output_datas diff --git a/sql_export_excel/readme/CONFIGURE.rst b/sql_export_excel/readme/CONFIGURE.rst new file mode 100644 index 0000000000..abf9be6e19 --- /dev/null +++ b/sql_export_excel/readme/CONFIGURE.rst @@ -0,0 +1,4 @@ +If you want Odoo to update an existing excel file, you should create an attachment +with the excel file and configure this attachment on the query. +Then, you can configure the query to indicate if Odoo should export the header and where it should +insert the data. By default, it will insert it in the first sheet, at first row/column. diff --git a/sql_export_excel/readme/CONTRIBUTORS.rst b/sql_export_excel/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..0bddb053ae --- /dev/null +++ b/sql_export_excel/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Florian da Costa diff --git a/sql_export_excel/readme/DESCRIPTION.rst b/sql_export_excel/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..4808db7b51 --- /dev/null +++ b/sql_export_excel/readme/DESCRIPTION.rst @@ -0,0 +1,4 @@ +Add the possibility to extract data from a sql query toward an excel file. +It is also possible to provide an template excel file for a query. In this case, +the data will be inserted in the specified sheet of the provided excel file. This +is usefull when doing a lot of calculation in excel and the data is coming from Odoo. diff --git a/sql_export_excel/tests/__init__.py b/sql_export_excel/tests/__init__.py new file mode 100644 index 0000000000..22c4421abe --- /dev/null +++ b/sql_export_excel/tests/__init__.py @@ -0,0 +1,2 @@ +# -*- 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 new file mode 100644 index 0000000000..a51423c673 --- /dev/null +++ b/sql_export_excel/tests/test_sql_query_excel.py @@ -0,0 +1,108 @@ +# -*- 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 +import base64 +from cStringIO import StringIO +import logging + +_logger = logging.getLogger(__name__) + +try: + import openpyxl +except ImportError: + _logger.debug('Can not import openpyxl') + + +class TestExportSqlQueryExcel(TransactionCase): + + def setUp(self): + super(TestExportSqlQueryExcel, self).setUp() + self.wizard_obj = self.env['sql.file.wizard'] + + def get_workbook_from_query(self, wizard): + wizard.export_sql() + decoded_data = base64.b64decode(wizard.binary_file) + xlsx_file = StringIO(decoded_data) + return openpyxl.load_workbook(xlsx_file) + + def test_excel_file_generation(self): + test_query = "SELECT 'testcol1' as firstcol, 2 as second_col" + query_vals = { + 'name': 'Test Query Excel', + 'query': test_query, + 'file_format': 'excel' + } + query = self.env['sql.export'].create(query_vals) + query.button_validate_sql_expression() + wizard = self.wizard_obj.create({ + 'sql_export_id': query.id, + }) + workbook = self.get_workbook_from_query(wizard) + ws = workbook.active + # Check values, header should be here by default + self.assertEqual(ws.cell(row=1, column=1).value, 'firstcol') + self.assertEqual(ws.cell(row=2, column=1).value, 'testcol1') + self.assertEqual(ws.cell(row=2, column=2).value, 2) + + query.write({'header': False}) + wb2 = self.get_workbook_from_query(wizard) + ws2 = wb2.active + # Check values, the header should not be present + self.assertEqual(ws2.cell(row=1, column=1).value, 'testcol1') + self.assertEqual(ws2.cell(row=1, column=2).value, 2) + + def test_excel_file_insert(self): + # Create excel file with 2 sheets. Create a header in second sheet + # where data will be inserted + wb = openpyxl.Workbook() + ws = wb.active + ws.cell(row=1, column=1, value="My Test Value") + 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() + wb.save(output) + data = output.getvalue() + + # Create attachment with the created xlsx file which will be used as + # template in the sql query + attachmnent_vals = { + 'name': 'template xlsx sql export Res Partner', + 'datas': base64.b64encode(data), + } + attachment = self.env['ir.attachment'].create(attachmnent_vals) + + # Create the query and configure it to insert the data in the second + # sheet of the xlsx template file and start inserting data at the + # second row, ignoring header (because the template excel file + # already contains a header) + test_query = "SELECT id, name FROM res_partner" + query_vals = { + 'name': 'Test Query Excel', + 'query': test_query, + 'file_format': 'excel', + 'attachment_id': attachment.id, + 'sheet_position': 2, + 'header': False, + 'row_position': 2, + } + query = self.env['sql.export'].create(query_vals) + query.button_validate_sql_expression() + wizard = self.wizard_obj.create({ + 'sql_export_id': query.id, + }) + + # Check the generated excel file. The first sheet should still contain + # the same data and the second sheet should have kept the header and + # inserted data from the query + wb2 = self.get_workbook_from_query(wizard) + sheets = wb2.worksheets + ws1 = sheets[0] + # Check values, header should be here by default + self.assertEqual(ws1.cell(row=1, column=1).value, 'My Test Value') + ws2 = sheets[1] + self.assertEqual(ws2.cell(row=1, column=1).value, 'Partner Id') + self.assertTrue(ws2.cell(row=2, column=1).value) diff --git a/sql_export_excel/views/sql_export_view.xml b/sql_export_excel/views/sql_export_view.xml new file mode 100644 index 0000000000..98fc3981c2 --- /dev/null +++ b/sql_export_excel/views/sql_export_view.xml @@ -0,0 +1,21 @@ + + + + + + + sql.export + + + + + + + + + + + + + + From 224f749270ca17a2e532c8544199bb3f1736d8df Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Mon, 2 Sep 2019 13:06:36 +0200 Subject: [PATCH 02/34] Migrate sql_export_excel to v12 --- sql_export_excel/{__openerp__.py => __manifest__.py} | 3 +-- sql_export_excel/models/sql_export.py | 7 +++---- sql_export_excel/tests/__init__.py | 1 - sql_export_excel/tests/test_sql_query_excel.py | 9 ++++----- 4 files changed, 8 insertions(+), 12 deletions(-) rename sql_export_excel/{__openerp__.py => __manifest__.py} (90%) 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 c130eece75..237b2df70f 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 bb1ea5e49b..48a45cf90a 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 @@ def excel_get_datas_from_query(self, variable_dict): # 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 @@ def excel_get_datas_from_query(self, variable_dict): 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 22c4421abe..6d89d7607e 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 a51423c673..b1433c55b8 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 @@ def setUp(self): 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 @@ def test_excel_file_insert(self): 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() From bf1481690908f12fe92ba55e31fe2d8035dcce53 Mon Sep 17 00:00:00 2001 From: Florian Date: Tue, 3 Sep 2019 11:37:56 +0200 Subject: [PATCH 03/34] Small fixes for v12/python3 standard Co-Authored-By: David Beal --- sql_export_excel/models/sql_export.py | 6 +++--- sql_export_excel/tests/test_sql_query_excel.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sql_export_excel/models/sql_export.py b/sql_export_excel/models/sql_export.py index 48a45cf90a..3479481e34 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 @@ def _get_file_extension(self): 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 b1433c55b8..5711ccb7c9 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 @@ 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): From 426d3198a2e67055ef28896713dea28000fe1957 Mon Sep 17 00:00:00 2001 From: oca-travis Date: Fri, 28 Aug 2020 08:53:23 +0000 Subject: [PATCH 04/34] [UPD] Update sql_export_excel.pot --- sql_export_excel/i18n/sql_export_excel.pot | 110 +++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 sql_export_excel/i18n/sql_export_excel.pot diff --git a/sql_export_excel/i18n/sql_export_excel.pot b/sql_export_excel/i18n/sql_export_excel.pot new file mode 100644 index 0000000000..7a178edff7 --- /dev/null +++ b/sql_export_excel/i18n/sql_export_excel.pot @@ -0,0 +1,110 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sql_export_excel +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: sql_export_excel +#: selection:sql.export,file_format:0 +msgid "CSV" +msgstr "" + +#. module: sql_export_excel +#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__col_position +msgid "Column Position" +msgstr "" + +#. module: sql_export_excel +#: selection:sql.export,file_format:0 +msgid "Excel" +msgstr "" + +#. module: sql_export_excel +#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__attachment_id +msgid "Excel Template" +msgstr "" + +#. module: sql_export_excel +#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__file_format +msgid "File Format" +msgstr "" + +#. module: sql_export_excel +#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__header +msgid "Header" +msgstr "" + +#. module: sql_export_excel +#: model:ir.model.fields,help:sql_export_excel.field_sql_export__attachment_id +msgid "If you configure an excel file (in xlsx format) here, the result of the query will be injected in it.\n" +"It is usefull to feed data in a excel file pre-configured with calculation" +msgstr "" + +#. module: sql_export_excel +#: model:ir.model.fields,help:sql_export_excel.field_sql_export__col_position +msgid "Indicate from which column the result of the query should be injected." +msgstr "" + +#. module: sql_export_excel +#: model:ir.model.fields,help:sql_export_excel.field_sql_export__row_position +msgid "Indicate from which row the result of the query should be injected." +msgstr "" + +#. module: sql_export_excel +#: model:ir.model.fields,help:sql_export_excel.field_sql_export__header +msgid "Indicate if the header should be exported to the file." +msgstr "" + +#. module: sql_export_excel +#: model:ir.model.fields,help:sql_export_excel.field_sql_export__sheet_position +msgid "Indicate the sheet's position of the excel template where the result of the sql query should be injected." +msgstr "" + +#. module: sql_export_excel +#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__row_position +msgid "Row Position" +msgstr "" + +#. module: sql_export_excel +#: model:ir.model,name:sql_export_excel.model_sql_export +msgid "SQL export" +msgstr "" + +#. module: sql_export_excel +#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__sheet_position +msgid "Sheet Position" +msgstr "" + +#. module: sql_export_excel +#: code:addons/sql_export_excel/models/sql_export.py:89 +#, python-format +msgid "The Excel Template file contains less than %s sheets Please, adjust the Sheet Position parameter." +msgstr "" + +#. module: sql_export_excel +#: code:addons/sql_export_excel/models/sql_export.py:62 +#, python-format +msgid "The column position can't be less than 1." +msgstr "" + +#. module: sql_export_excel +#: code:addons/sql_export_excel/models/sql_export.py:55 +#, python-format +msgid "The row position can't be less than 1." +msgstr "" + +#. module: sql_export_excel +#: code:addons/sql_export_excel/models/sql_export.py:48 +#, python-format +msgid "The sheet position can't be less than 1." +msgstr "" + From 48eda0498d6b360eebb415ecd779d7d50e444ea3 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Fri, 28 Aug 2020 09:14:49 +0000 Subject: [PATCH 05/34] [UPD] README.rst --- sql_export_excel/README.rst | 73 ++- .../static/description/index.html | 430 ++++++++++++++++++ 2 files changed, 485 insertions(+), 18 deletions(-) create mode 100644 sql_export_excel/static/description/index.html diff --git a/sql_export_excel/README.rst b/sql_export_excel/README.rst index 5fb7bb10cb..ea24d59fe0 100644 --- a/sql_export_excel/README.rst +++ b/sql_export_excel/README.rst @@ -1,47 +1,84 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :alt: License: AGPL-3 - +================ SQL Export Excel ================ +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github + :target: https://github.com/OCA/server-tools/tree/12.0/sql_export_excel + :alt: OCA/server-tools +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-sql_export_excel + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/149/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + Add the possibility to extract data from a sql query toward an excel file. It is also possible to provide an template excel file for a query. In this case, the data will be inserted in the specified sheet of the provided excel file. This is usefull when doing a lot of calculation in excel and the data is coming from Odoo. -Known issues / Roadmap -====================== +**Table of contents** + +.. contents:: + :local: -* It was designed to work with xlsx files only, xls format is not supported. +Configuration +============= +If you want Odoo to update an existing excel file, you should create an attachment +with the excel file and configure this attachment on the query. +Then, you can configure the query to indicate if Odoo should export the header and where it should +insert the data. By default, it will insert it in the first sheet, at first row/column. Bug Tracker =========== -Bugs are tracked on `GitHub Issues -`_. In case of trouble, please -check there if your issue has already been reported. If you spotted it first, -help us smash it by providing detailed and welcomed feedback. +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. Credits ======= +Authors +~~~~~~~ + +* Akretion + Contributors ------------- +~~~~~~~~~~~~ * Florian da Costa -Maintainer ----------- - -.. image:: http://odoo-community.org/logo.png - :alt: Odoo Community Association - :target: http://odoo-community.org +Maintainers +~~~~~~~~~~~ This module is maintained by the OCA. +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -To contribute to this module, please visit http://odoo-community.org. +This module is part of the `OCA/server-tools `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sql_export_excel/static/description/index.html b/sql_export_excel/static/description/index.html new file mode 100644 index 0000000000..33f5cc6748 --- /dev/null +++ b/sql_export_excel/static/description/index.html @@ -0,0 +1,430 @@ + + + + + + +SQL Export Excel + + + +
+

SQL Export Excel

+ + +

Beta License: AGPL-3 OCA/server-tools Translate me on Weblate Try me on Runbot

+

Add the possibility to extract data from a sql query toward an excel file. +It is also possible to provide an template excel file for a query. In this case, +the data will be inserted in the specified sheet of the provided excel file. This +is usefull when doing a lot of calculation in excel and the data is coming from Odoo.

+

Table of contents

+ +
+

Configuration

+

If you want Odoo to update an existing excel file, you should create an attachment +with the excel file and configure this attachment on the query. +Then, you can configure the query to indicate if Odoo should export the header and where it should +insert the data. By default, it will insert it in the first sheet, at first row/column.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Akretion
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/server-tools project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + From b6f63396e5d118831c43707b860369b4f231be9e Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Fri, 28 Aug 2020 09:14:49 +0000 Subject: [PATCH 06/34] [ADD] icon.png --- sql_export_excel/static/description/icon.png | Bin 0 -> 9455 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 sql_export_excel/static/description/icon.png diff --git a/sql_export_excel/static/description/icon.png b/sql_export_excel/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~! zVpnB`o+K7|Al`Q_U;eD$B zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#*^6~AI|YzIWy$Cu#CSLW3q=GA z6`?GZymC;dCPk~rBS%eCb`5OLr;RUZ;D`}um=H)BfVIq%7VhiMr)_#G0N#zrNH|__ zc+blN2UAB0=617@>_u;MPHN;P;N#YoE=)R#i$k_`UAA>WWCcEVMh~L_ zj--gtp&|K1#58Yz*AHCTMziU1Jzt_jG0I@qAOHsk$2}yTmVkBp_eHuY$A9)>P6o~I z%aQ?!(GqeQ-Y+b0I(m9pwgi(IIZZzsbMv+9w{PFtd_<_(LA~0H(xz{=FhLB@(1&qHA5EJw1>>=%q2f&^X>IQ{!GJ4e9U z&KlB)z(84HmNgm2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6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t< z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 From bd8808a9c5082f225ae8c4721a7b1218ef52ff45 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Thu, 8 Apr 2021 12:23:27 +0200 Subject: [PATCH 07/34] [FIX] sql_export_excel: add missing dependency to python lib openpyxl --- sql_export_excel/__manifest__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sql_export_excel/__manifest__.py b/sql_export_excel/__manifest__.py index 237b2df70f..95cc1288bc 100644 --- a/sql_export_excel/__manifest__.py +++ b/sql_export_excel/__manifest__.py @@ -12,6 +12,11 @@ 'depends': [ 'sql_export', ], + 'external_dependencies': { + 'python': [ + 'openpyxl', + ], + }, 'data': [ 'views/sql_export_view.xml', ], From 9759ce77b1cc93be2dbcb3e2c0fde3f08908cd31 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Fri, 30 Apr 2021 18:14:52 +0000 Subject: [PATCH 08/34] sql_export_excel 12.0.1.1.0 --- sql_export_excel/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql_export_excel/__manifest__.py b/sql_export_excel/__manifest__.py index 95cc1288bc..bc11bdc3b4 100644 --- a/sql_export_excel/__manifest__.py +++ b/sql_export_excel/__manifest__.py @@ -3,7 +3,7 @@ { 'name': 'SQL Export Excel', - 'version': '12.0.1.0.0', + 'version': '12.0.1.1.0', 'author': 'Akretion,Odoo Community Association (OCA)', 'website': 'http://github/oca/server-tools', 'license': 'AGPL-3', From 4affb84e313559adbc61f49438331f00f541d782 Mon Sep 17 00:00:00 2001 From: hkapatel Date: Mon, 21 Jun 2021 18:18:03 +0530 Subject: [PATCH 09/34] [IMP] sql_export_excel: black, isort, prettier --- sql_export_excel/__manifest__.py | 32 ++++----- sql_export_excel/models/sql_export.py | 66 ++++++++++------- .../tests/test_sql_query_excel.py | 72 ++++++++++--------- sql_export_excel/views/sql_export_view.xml | 27 +++++-- 4 files changed, 114 insertions(+), 83 deletions(-) diff --git a/sql_export_excel/__manifest__.py b/sql_export_excel/__manifest__.py index bc11bdc3b4..7e2f5d13c5 100644 --- a/sql_export_excel/__manifest__.py +++ b/sql_export_excel/__manifest__.py @@ -2,23 +2,23 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { - 'name': 'SQL Export Excel', - 'version': '12.0.1.1.0', - 'author': 'Akretion,Odoo Community Association (OCA)', - 'website': 'http://github/oca/server-tools', - 'license': 'AGPL-3', - 'category': 'Generic Modules/Others', - 'summary': 'Allow to export a sql query to an excel file.', - 'depends': [ - 'sql_export', + "name": "SQL Export Excel", + "version": "12.0.1.1.0", + "author": "Akretion,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/server-tools", + "license": "AGPL-3", + "category": "Generic Modules/Others", + "summary": "Allow to export a sql query to an excel file.", + "depends": [ + "sql_export", ], - 'external_dependencies': { - 'python': [ - 'openpyxl', + "external_dependencies": { + "python": [ + "openpyxl", ], }, - 'data': [ - 'views/sql_export_view.xml', + "data": [ + "views/sql_export_view.xml", ], - 'installable': True, - } + "installable": True, +} diff --git a/sql_export_excel/models/sql_export.py b/sql_export_excel/models/sql_export.py index 3479481e34..01a3f20f49 100644 --- a/sql_export_excel/models/sql_export.py +++ b/sql_export_excel/models/sql_export.py @@ -1,71 +1,79 @@ # Copyright 2019 Akretion # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from odoo import api, exceptions, fields, models, _ -from io import BytesIO -import logging import base64 +import logging +from io import BytesIO + +from odoo import _, api, exceptions, fields, models + _logger = logging.getLogger(__name__) try: import openpyxl except ImportError: - _logger.debug('Can not import openpyxl') + _logger.debug("Can not import openpyxl") class SqlExport(models.Model): - _inherit = 'sql.export' + _inherit = "sql.export" - file_format = fields.Selection( - selection_add=[('excel', 'Excel')]) + file_format = fields.Selection(selection_add=[("excel", "Excel")]) header = fields.Boolean( - default=True, - help="Indicate if the header should be exported to the file.") + default=True, help="Indicate if the header should be exported to the file." + ) attachment_id = fields.Many2one( - 'ir.attachment', string='Excel Template', + "ir.attachment", + string="Excel Template", help="If you configure an excel file (in xlsx format) here, the " - "result of the query will be injected in it.\nIt is usefull to " - "feed data in a excel file pre-configured with calculation") + "result of the query will be injected in it.\nIt is usefull to " + "feed data in a excel file pre-configured with calculation", + ) sheet_position = fields.Integer( default=1, help="Indicate the sheet's position of the excel template where the " - "result of the sql query should be injected.") + "result of the sql query should be injected.", + ) row_position = fields.Integer( default=1, - help="Indicate from which row the result of the query should be " - "injected.") + help="Indicate from which row the result of the query should be " "injected.", + ) col_position = fields.Integer( string="Column Position", default=1, help="Indicate from which column the result of the query should be " - "injected.") + "injected.", + ) - @api.constrains('sheet_position') + @api.constrains("sheet_position") def check_sheet_position(self): for export in self: if export.sheet_position < 1: raise exceptions.ValidationError( - _("The sheet position can't be less than 1.")) + _("The sheet position can't be less than 1.") + ) - @api.constrains('row_position') + @api.constrains("row_position") def check_row_position(self): for export in self: if export.row_position < 1: raise exceptions.ValidationError( - _("The row position can't be less than 1.")) + _("The row position can't be less than 1.") + ) - @api.constrains('col_position') + @api.constrains("col_position") def check_column_position(self): for export in self: if export.col_position < 1: raise exceptions.ValidationError( - _("The column position can't be less than 1.")) + _("The column position can't be less than 1.") + ) @api.multi def _get_file_extension(self): self.ensure_one() - if self.file_format == 'excel': - return 'xlsx' + if self.file_format == "excel": + return "xlsx" else: return super()._get_file_extension() @@ -73,7 +81,8 @@ def _get_file_extension(self): 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) + params=variable_dict, mode="fetchall", header=self.header + ) # Case we insert data in an existing excel file. if self.attachment_id: datas = self.attachment_id.datas @@ -86,8 +95,11 @@ def excel_get_data_from_query(self, variable_dict): ws = sheets[self.sheet_position - 1] except IndexError: raise exceptions.ValidationError( - _("The Excel Template file contains less than %s sheets " - "Please, adjust the Sheet Position parameter.")) + _( + "The Excel Template file contains less than %s sheets " + "Please, adjust the Sheet Position parameter." + ) + ) row_position = self.row_position or 1 col_position = self.col_position or 1 # Case of excel file creation diff --git a/sql_export_excel/tests/test_sql_query_excel.py b/sql_export_excel/tests/test_sql_query_excel.py index 5711ccb7c9..6ee1f3a1fa 100644 --- a/sql_export_excel/tests/test_sql_query_excel.py +++ b/sql_export_excel/tests/test_sql_query_excel.py @@ -2,24 +2,24 @@ # @author: Florian da Costa # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from odoo.tests.common import TransactionCase import base64 -from io import BytesIO import logging +from io import BytesIO + +from odoo.tests.common import TransactionCase _logger = logging.getLogger(__name__) try: import openpyxl except ImportError: - _logger.debug('Can not import openpyxl') + _logger.debug("Can not import openpyxl") class TestExportSqlQueryExcel(TransactionCase): - def setUp(self): super().setUp() - self.wizard_obj = self.env['sql.file.wizard'] + self.wizard_obj = self.env["sql.file.wizard"] def get_workbook_from_query(self, wizard): wizard.export_sql() @@ -30,27 +30,29 @@ def get_workbook_from_query(self, wizard): def test_excel_file_generation(self): test_query = "SELECT 'testcol1' as firstcol, 2 as second_col" query_vals = { - 'name': 'Test Query Excel', - 'query': test_query, - 'file_format': 'excel' + "name": "Test Query Excel", + "query": test_query, + "file_format": "excel", } - query = self.env['sql.export'].create(query_vals) + query = self.env["sql.export"].create(query_vals) query.button_validate_sql_expression() - wizard = self.wizard_obj.create({ - 'sql_export_id': query.id, - }) + wizard = self.wizard_obj.create( + { + "sql_export_id": query.id, + } + ) workbook = self.get_workbook_from_query(wizard) ws = workbook.active # Check values, header should be here by default - self.assertEqual(ws.cell(row=1, column=1).value, 'firstcol') - self.assertEqual(ws.cell(row=2, column=1).value, 'testcol1') + self.assertEqual(ws.cell(row=1, column=1).value, "firstcol") + self.assertEqual(ws.cell(row=2, column=1).value, "testcol1") self.assertEqual(ws.cell(row=2, column=2).value, 2) - query.write({'header': False}) + query.write({"header": False}) wb2 = self.get_workbook_from_query(wizard) ws2 = wb2.active # Check values, the header should not be present - self.assertEqual(ws2.cell(row=1, column=1).value, 'testcol1') + self.assertEqual(ws2.cell(row=1, column=1).value, "testcol1") self.assertEqual(ws2.cell(row=1, column=2).value, 2) def test_excel_file_insert(self): @@ -60,8 +62,8 @@ def test_excel_file_insert(self): ws = wb.active ws.cell(row=1, column=1, value="My Test Value") ws2 = wb.create_sheet("data") - ws2.cell(row=1, column=1, value='Partner Id') - ws2.cell(row=1, column=2, value='Partner Name') + ws2.cell(row=1, column=1, value="Partner Id") + ws2.cell(row=1, column=2, value="Partner Name") output = BytesIO() wb.save(output) data = output.getvalue() @@ -69,10 +71,10 @@ def test_excel_file_insert(self): # Create attachment with the created xlsx file which will be used as # template in the sql query attachmnent_vals = { - 'name': 'template xlsx sql export Res Partner', - 'datas': base64.b64encode(data), + "name": "template xlsx sql export Res Partner", + "datas": base64.b64encode(data), } - attachment = self.env['ir.attachment'].create(attachmnent_vals) + attachment = self.env["ir.attachment"].create(attachmnent_vals) # Create the query and configure it to insert the data in the second # sheet of the xlsx template file and start inserting data at the @@ -80,19 +82,21 @@ def test_excel_file_insert(self): # already contains a header) test_query = "SELECT id, name FROM res_partner" query_vals = { - 'name': 'Test Query Excel', - 'query': test_query, - 'file_format': 'excel', - 'attachment_id': attachment.id, - 'sheet_position': 2, - 'header': False, - 'row_position': 2, + "name": "Test Query Excel", + "query": test_query, + "file_format": "excel", + "attachment_id": attachment.id, + "sheet_position": 2, + "header": False, + "row_position": 2, } - query = self.env['sql.export'].create(query_vals) + query = self.env["sql.export"].create(query_vals) query.button_validate_sql_expression() - wizard = self.wizard_obj.create({ - 'sql_export_id': query.id, - }) + wizard = self.wizard_obj.create( + { + "sql_export_id": query.id, + } + ) # Check the generated excel file. The first sheet should still contain # the same data and the second sheet should have kept the header and @@ -101,7 +105,7 @@ def test_excel_file_insert(self): sheets = wb2.worksheets ws1 = sheets[0] # Check values, header should be here by default - self.assertEqual(ws1.cell(row=1, column=1).value, 'My Test Value') + self.assertEqual(ws1.cell(row=1, column=1).value, "My Test Value") ws2 = sheets[1] - self.assertEqual(ws2.cell(row=1, column=1).value, 'Partner Id') + self.assertEqual(ws2.cell(row=1, column=1).value, "Partner Id") self.assertTrue(ws2.cell(row=2, column=1).value) diff --git a/sql_export_excel/views/sql_export_view.xml b/sql_export_excel/views/sql_export_view.xml index 98fc3981c2..da26c05038 100644 --- a/sql_export_excel/views/sql_export_view.xml +++ b/sql_export_excel/views/sql_export_view.xml @@ -1,4 +1,4 @@ - + @@ -8,11 +8,26 @@ - - - - - + + + + + From 61ef170240269ba6e6259a42fdcab99ab15a47c4 Mon Sep 17 00:00:00 2001 From: hkapatel Date: Wed, 23 Jun 2021 09:55:27 +0530 Subject: [PATCH 10/34] [MIG] sql_export_excel: Migration to 14.0 --- sql_export_excel/__manifest__.py | 6 ++---- sql_export_excel/models/sql_export.py | 6 +++--- sql_export_excel/readme/CONTRIBUTORS.rst | 1 + 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/sql_export_excel/__manifest__.py b/sql_export_excel/__manifest__.py index 7e2f5d13c5..3562741c84 100644 --- a/sql_export_excel/__manifest__.py +++ b/sql_export_excel/__manifest__.py @@ -3,15 +3,13 @@ { "name": "SQL Export Excel", - "version": "12.0.1.1.0", + "version": "14.0.1.1.0", "author": "Akretion,Odoo Community Association (OCA)", "website": "https://github.com/OCA/server-tools", "license": "AGPL-3", "category": "Generic Modules/Others", "summary": "Allow to export a sql query to an excel file.", - "depends": [ - "sql_export", - ], + "depends": ["sql_export"], "external_dependencies": { "python": [ "openpyxl", diff --git a/sql_export_excel/models/sql_export.py b/sql_export_excel/models/sql_export.py index 01a3f20f49..6165abe486 100644 --- a/sql_export_excel/models/sql_export.py +++ b/sql_export_excel/models/sql_export.py @@ -18,7 +18,9 @@ class SqlExport(models.Model): _inherit = "sql.export" - file_format = fields.Selection(selection_add=[("excel", "Excel")]) + file_format = fields.Selection( + selection_add=[("excel", "Excel")], ondelete={"excel": "set default"} + ) header = fields.Boolean( default=True, help="Indicate if the header should be exported to the file." ) @@ -69,7 +71,6 @@ def check_column_position(self): _("The column position can't be less than 1.") ) - @api.multi def _get_file_extension(self): self.ensure_one() if self.file_format == "excel": @@ -77,7 +78,6 @@ def _get_file_extension(self): else: return super()._get_file_extension() - @api.multi def excel_get_data_from_query(self, variable_dict): self.ensure_one() res = self._execute_sql_request( diff --git a/sql_export_excel/readme/CONTRIBUTORS.rst b/sql_export_excel/readme/CONTRIBUTORS.rst index 0bddb053ae..c2183a83da 100644 --- a/sql_export_excel/readme/CONTRIBUTORS.rst +++ b/sql_export_excel/readme/CONTRIBUTORS.rst @@ -1 +1,2 @@ * Florian da Costa +* Helly kapatel From 30501dc54cb0bea1637b22953a690b2285d6cb1d Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Thu, 29 Jul 2021 11:13:43 +0000 Subject: [PATCH 11/34] [UPD] README.rst --- sql_export_excel/README.rst | 11 ++++++----- sql_export_excel/static/description/index.html | 7 ++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/sql_export_excel/README.rst b/sql_export_excel/README.rst index ea24d59fe0..2d3ebadf12 100644 --- a/sql_export_excel/README.rst +++ b/sql_export_excel/README.rst @@ -14,13 +14,13 @@ SQL Export Excel :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github - :target: https://github.com/OCA/server-tools/tree/12.0/sql_export_excel + :target: https://github.com/OCA/server-tools/tree/14.0/sql_export_excel :alt: OCA/server-tools .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-sql_export_excel + :target: https://translation.odoo-community.org/projects/server-tools-14-0/server-tools-14-0-sql_export_excel :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/149/12.0 + :target: https://runbot.odoo-community.org/runbot/149/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -49,7 +49,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -65,6 +65,7 @@ Contributors ~~~~~~~~~~~~ * Florian da Costa +* Helly kapatel Maintainers ~~~~~~~~~~~ @@ -79,6 +80,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/server-tools `_ project on GitHub. +This module is part of the `OCA/server-tools `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sql_export_excel/static/description/index.html b/sql_export_excel/static/description/index.html index 33f5cc6748..4fb831b8f2 100644 --- a/sql_export_excel/static/description/index.html +++ b/sql_export_excel/static/description/index.html @@ -367,7 +367,7 @@

SQL Export Excel

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/server-tools Translate me on Weblate Try me on Runbot

+

Beta License: AGPL-3 OCA/server-tools Translate me on Weblate Try me on Runbot

Add the possibility to extract data from a sql query toward an excel file. It is also possible to provide an template excel file for a query. In this case, the data will be inserted in the specified sheet of the provided excel file. This @@ -397,7 +397,7 @@

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -412,6 +412,7 @@

Authors

Contributors

@@ -421,7 +422,7 @@

Maintainers

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

-

This module is part of the OCA/server-tools project on GitHub.

+

This module is part of the OCA/server-tools project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

From b50ea40766a1036ef560fe19489bedb646a78cfa Mon Sep 17 00:00:00 2001 From: oca-travis Date: Fri, 6 Aug 2021 07:02:51 +0000 Subject: [PATCH 12/34] [UPD] Update sql_export_excel.pot --- sql_export_excel/i18n/sql_export_excel.pot | 51 +++++++++++++++------- 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/sql_export_excel/i18n/sql_export_excel.pot b/sql_export_excel/i18n/sql_export_excel.pot index 7a178edff7..cc6eb97ab8 100644 --- a/sql_export_excel/i18n/sql_export_excel.pot +++ b/sql_export_excel/i18n/sql_export_excel.pot @@ -1,12 +1,12 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * sql_export_excel +# * sql_export_excel # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: <>\n" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -14,17 +14,17 @@ msgstr "" "Plural-Forms: \n" #. module: sql_export_excel -#: selection:sql.export,file_format:0 -msgid "CSV" +#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__col_position +msgid "Column Position" msgstr "" #. module: sql_export_excel -#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__col_position -msgid "Column Position" +#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__display_name +msgid "Display Name" msgstr "" #. module: sql_export_excel -#: selection:sql.export,file_format:0 +#: model:ir.model.fields.selection,name:sql_export_excel.selection__sql_export__file_format__excel msgid "Excel" msgstr "" @@ -43,9 +43,15 @@ msgstr "" msgid "Header" msgstr "" +#. module: sql_export_excel +#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__id +msgid "ID" +msgstr "" + #. module: sql_export_excel #: model:ir.model.fields,help:sql_export_excel.field_sql_export__attachment_id -msgid "If you configure an excel file (in xlsx format) here, the result of the query will be injected in it.\n" +msgid "" +"If you configure an excel file (in xlsx format) here, the result of the query will be injected in it.\n" "It is usefull to feed data in a excel file pre-configured with calculation" msgstr "" @@ -66,7 +72,14 @@ msgstr "" #. module: sql_export_excel #: model:ir.model.fields,help:sql_export_excel.field_sql_export__sheet_position -msgid "Indicate the sheet's position of the excel template where the result of the sql query should be injected." +msgid "" +"Indicate the sheet's position of the excel template where the result of the " +"sql query should be injected." +msgstr "" + +#. module: sql_export_excel +#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export____last_update +msgid "Last Modified on" msgstr "" #. module: sql_export_excel @@ -85,26 +98,32 @@ msgid "Sheet Position" msgstr "" #. module: sql_export_excel -#: code:addons/sql_export_excel/models/sql_export.py:89 +#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__smart_search +msgid "Smart Search" +msgstr "" + +#. module: sql_export_excel +#: code:addons/sql_export_excel/models/sql_export.py:0 #, python-format -msgid "The Excel Template file contains less than %s sheets Please, adjust the Sheet Position parameter." +msgid "" +"The Excel Template file contains less than %s sheets Please, adjust the " +"Sheet Position parameter." msgstr "" #. module: sql_export_excel -#: code:addons/sql_export_excel/models/sql_export.py:62 +#: code:addons/sql_export_excel/models/sql_export.py:0 #, python-format msgid "The column position can't be less than 1." msgstr "" #. module: sql_export_excel -#: code:addons/sql_export_excel/models/sql_export.py:55 +#: code:addons/sql_export_excel/models/sql_export.py:0 #, python-format msgid "The row position can't be less than 1." msgstr "" #. module: sql_export_excel -#: code:addons/sql_export_excel/models/sql_export.py:48 +#: code:addons/sql_export_excel/models/sql_export.py:0 #, python-format msgid "The sheet position can't be less than 1." msgstr "" - From 33bf72f97ff7b32211a5da9c046f0e55e5373eaf Mon Sep 17 00:00:00 2001 From: oca-travis Date: Thu, 2 Sep 2021 14:18:35 +0000 Subject: [PATCH 13/34] [UPD] Update sql_export_excel.pot --- sql_export_excel/i18n/sql_export_excel.pot | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/sql_export_excel/i18n/sql_export_excel.pot b/sql_export_excel/i18n/sql_export_excel.pot index cc6eb97ab8..cfdca2ab9c 100644 --- a/sql_export_excel/i18n/sql_export_excel.pot +++ b/sql_export_excel/i18n/sql_export_excel.pot @@ -13,11 +13,31 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: sql_export_excel +#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__changeset_change_ids +msgid "Changeset Changes" +msgstr "" + +#. module: sql_export_excel +#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__changeset_ids +msgid "Changesets" +msgstr "" + #. module: sql_export_excel #: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__col_position msgid "Column Position" msgstr "" +#. module: sql_export_excel +#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__count_pending_changeset_changes +msgid "Count Pending Changeset Changes" +msgstr "" + +#. module: sql_export_excel +#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__count_pending_changesets +msgid "Count Pending Changesets" +msgstr "" + #. module: sql_export_excel #: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__display_name msgid "Display Name" @@ -127,3 +147,8 @@ msgstr "" #, python-format msgid "The sheet position can't be less than 1." msgstr "" + +#. module: sql_export_excel +#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__user_can_see_changeset +msgid "User Can See Changeset" +msgstr "" From 475d7e1986bc4cb55660e7412c8922434c7195b7 Mon Sep 17 00:00:00 2001 From: Maksym Yankin Date: Mon, 31 Jan 2022 16:01:30 +0200 Subject: [PATCH 14/34] [IMP] sql_export_excel: pylint --- sql_export_excel/models/sql_export.py | 4 +-- sql_export_excel/views/sql_export_view.xml | 37 ++++++++++------------ 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/sql_export_excel/models/sql_export.py b/sql_export_excel/models/sql_export.py index 6165abe486..53cde9f076 100644 --- a/sql_export_excel/models/sql_export.py +++ b/sql_export_excel/models/sql_export.py @@ -93,13 +93,13 @@ def excel_get_data_from_query(self, variable_dict): sheets = wb.worksheets try: ws = sheets[self.sheet_position - 1] - except IndexError: + except IndexError as err: raise exceptions.ValidationError( _( "The Excel Template file contains less than %s sheets " "Please, adjust the Sheet Position parameter." ) - ) + ) from err row_position = self.row_position or 1 col_position = self.col_position or 1 # Case of excel file creation diff --git a/sql_export_excel/views/sql_export_view.xml b/sql_export_excel/views/sql_export_view.xml index da26c05038..92669eef7f 100644 --- a/sql_export_excel/views/sql_export_view.xml +++ b/sql_export_excel/views/sql_export_view.xml @@ -1,7 +1,5 @@ - - - + sql.export @@ -9,28 +7,27 @@ + name="header" + attrs="{'invisible': [('file_format', '=', 'csv')]}" + /> + name="attachment_id" + attrs="{'invisible': [('file_format', '!=', 'excel')]}" + /> + name="sheet_position" + attrs="{'invisible': [('attachment_id', '=', False)]}" + /> + name="row_position" + attrs="{'invisible': [('attachment_id', '=', False)]}" + /> + name="col_position" + attrs="{'invisible': [('attachment_id', '=', False)]}" + /> - - + From dffdea7c398ab6521e3d53c1fc0a70f90f121ff0 Mon Sep 17 00:00:00 2001 From: Maksym Yankin Date: Mon, 31 Jan 2022 16:04:01 +0200 Subject: [PATCH 15/34] [MIG] sql_export_excel: Migration to 15.0 --- sql_export_excel/README.rst | 14 +++++++------- sql_export_excel/__manifest__.py | 4 ++-- sql_export_excel/i18n/sql_export_excel.pot | 2 +- sql_export_excel/static/description/index.html | 8 ++++---- sql_export_excel/tests/test_sql_query_excel.py | 7 ++++--- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/sql_export_excel/README.rst b/sql_export_excel/README.rst index 2d3ebadf12..01f868200d 100644 --- a/sql_export_excel/README.rst +++ b/sql_export_excel/README.rst @@ -14,13 +14,13 @@ SQL Export Excel :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github - :target: https://github.com/OCA/server-tools/tree/14.0/sql_export_excel - :alt: OCA/server-tools + :target: https://github.com/OCA/reporting-engine/tree/15.0/sql_export_excel + :alt: OCA/reporting-engine .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/server-tools-14-0/server-tools-14-0-sql_export_excel + :target: https://translation.odoo-community.org/projects/reporting-engine-15-0/reporting-engine-15-0-sql_export_excel :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/149/14.0 + :target: https://runbot.odoo-community.org/runbot/149/15.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -46,10 +46,10 @@ insert the data. By default, it will insert it in the first sheet, at first row/ Bug Tracker =========== -Bugs are tracked on `GitHub Issues `_. +Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -80,6 +80,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/server-tools `_ project on GitHub. +This module is part of the `OCA/reporting-engine `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sql_export_excel/__manifest__.py b/sql_export_excel/__manifest__.py index 3562741c84..99d3063eb0 100644 --- a/sql_export_excel/__manifest__.py +++ b/sql_export_excel/__manifest__.py @@ -3,9 +3,9 @@ { "name": "SQL Export Excel", - "version": "14.0.1.1.0", + "version": "15.0.1.0.0", "author": "Akretion,Odoo Community Association (OCA)", - "website": "https://github.com/OCA/server-tools", + "website": "https://github.com/OCA/reporting-engine", "license": "AGPL-3", "category": "Generic Modules/Others", "summary": "Allow to export a sql query to an excel file.", diff --git a/sql_export_excel/i18n/sql_export_excel.pot b/sql_export_excel/i18n/sql_export_excel.pot index cfdca2ab9c..a3b912de0a 100644 --- a/sql_export_excel/i18n/sql_export_excel.pot +++ b/sql_export_excel/i18n/sql_export_excel.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 14.0\n" +"Project-Id-Version: Odoo Server 15.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" diff --git a/sql_export_excel/static/description/index.html b/sql_export_excel/static/description/index.html index 4fb831b8f2..0c2222e482 100644 --- a/sql_export_excel/static/description/index.html +++ b/sql_export_excel/static/description/index.html @@ -367,7 +367,7 @@

SQL Export Excel

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/server-tools Translate me on Weblate Try me on Runbot

+

Beta License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runbot

Add the possibility to extract data from a sql query toward an excel file. It is also possible to provide an template excel file for a query. In this case, the data will be inserted in the specified sheet of the provided excel file. This @@ -394,10 +394,10 @@

Configuration

Bug Tracker

-

Bugs are tracked on GitHub Issues. +

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -422,7 +422,7 @@

Maintainers

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

-

This module is part of the OCA/server-tools project on GitHub.

+

This module is part of the OCA/reporting-engine project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/sql_export_excel/tests/test_sql_query_excel.py b/sql_export_excel/tests/test_sql_query_excel.py index 6ee1f3a1fa..7dc03c5a91 100644 --- a/sql_export_excel/tests/test_sql_query_excel.py +++ b/sql_export_excel/tests/test_sql_query_excel.py @@ -17,9 +17,10 @@ class TestExportSqlQueryExcel(TransactionCase): - def setUp(self): - super().setUp() - self.wizard_obj = self.env["sql.file.wizard"] + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.wizard_obj = cls.env["sql.file.wizard"] def get_workbook_from_query(self, wizard): wizard.export_sql() From 2f579364b31eb83c8aee0d77ed45ba9e74e72b03 Mon Sep 17 00:00:00 2001 From: oca-ci Date: Wed, 2 Feb 2022 07:46:43 +0000 Subject: [PATCH 16/34] [UPD] Update sql_export_excel.pot --- sql_export_excel/i18n/sql_export_excel.pot | 45 ---------------------- 1 file changed, 45 deletions(-) diff --git a/sql_export_excel/i18n/sql_export_excel.pot b/sql_export_excel/i18n/sql_export_excel.pot index a3b912de0a..ce27a4f1f5 100644 --- a/sql_export_excel/i18n/sql_export_excel.pot +++ b/sql_export_excel/i18n/sql_export_excel.pot @@ -13,36 +13,11 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" -#. module: sql_export_excel -#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__changeset_change_ids -msgid "Changeset Changes" -msgstr "" - -#. module: sql_export_excel -#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__changeset_ids -msgid "Changesets" -msgstr "" - #. module: sql_export_excel #: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__col_position msgid "Column Position" msgstr "" -#. module: sql_export_excel -#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__count_pending_changeset_changes -msgid "Count Pending Changeset Changes" -msgstr "" - -#. module: sql_export_excel -#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__count_pending_changesets -msgid "Count Pending Changesets" -msgstr "" - -#. module: sql_export_excel -#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__display_name -msgid "Display Name" -msgstr "" - #. module: sql_export_excel #: model:ir.model.fields.selection,name:sql_export_excel.selection__sql_export__file_format__excel msgid "Excel" @@ -63,11 +38,6 @@ msgstr "" msgid "Header" msgstr "" -#. module: sql_export_excel -#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__id -msgid "ID" -msgstr "" - #. module: sql_export_excel #: model:ir.model.fields,help:sql_export_excel.field_sql_export__attachment_id msgid "" @@ -97,11 +67,6 @@ msgid "" "sql query should be injected." msgstr "" -#. module: sql_export_excel -#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export____last_update -msgid "Last Modified on" -msgstr "" - #. module: sql_export_excel #: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__row_position msgid "Row Position" @@ -117,11 +82,6 @@ msgstr "" msgid "Sheet Position" msgstr "" -#. module: sql_export_excel -#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__smart_search -msgid "Smart Search" -msgstr "" - #. module: sql_export_excel #: code:addons/sql_export_excel/models/sql_export.py:0 #, python-format @@ -147,8 +107,3 @@ msgstr "" #, python-format msgid "The sheet position can't be less than 1." msgstr "" - -#. module: sql_export_excel -#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__user_can_see_changeset -msgid "User Can See Changeset" -msgstr "" From 8441addded9cf8367e16f91800870e28dd14c27a Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Wed, 2 Feb 2022 07:49:09 +0000 Subject: [PATCH 17/34] [UPD] README.rst --- sql_export_excel/README.rst | 4 ++-- sql_export_excel/static/description/index.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sql_export_excel/README.rst b/sql_export_excel/README.rst index 01f868200d..db81423417 100644 --- a/sql_export_excel/README.rst +++ b/sql_export_excel/README.rst @@ -13,14 +13,14 @@ SQL Export Excel .. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 -.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github :target: https://github.com/OCA/reporting-engine/tree/15.0/sql_export_excel :alt: OCA/reporting-engine .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png :target: https://translation.odoo-community.org/projects/reporting-engine-15-0/reporting-engine-15-0-sql_export_excel :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/149/15.0 + :target: https://runbot.odoo-community.org/runbot/143/15.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| diff --git a/sql_export_excel/static/description/index.html b/sql_export_excel/static/description/index.html index 0c2222e482..1b0f536af5 100644 --- a/sql_export_excel/static/description/index.html +++ b/sql_export_excel/static/description/index.html @@ -367,7 +367,7 @@

SQL Export Excel

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runbot

+

Beta License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runbot

Add the possibility to extract data from a sql query toward an excel file. It is also possible to provide an template excel file for a query. In this case, the data will be inserted in the specified sheet of the provided excel file. This From 7ee4d34b28c694587421d63015d166c33b974423 Mon Sep 17 00:00:00 2001 From: jabelchi Date: Wed, 15 Jun 2022 15:38:14 +0000 Subject: [PATCH 18/34] Added translation using Weblate (Catalan) --- sql_export_excel/i18n/ca.po | 110 ++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 sql_export_excel/i18n/ca.po diff --git a/sql_export_excel/i18n/ca.po b/sql_export_excel/i18n/ca.po new file mode 100644 index 0000000000..c9b37708da --- /dev/null +++ b/sql_export_excel/i18n/ca.po @@ -0,0 +1,110 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sql_export_excel +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: ca\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#. module: sql_export_excel +#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__col_position +msgid "Column Position" +msgstr "" + +#. module: sql_export_excel +#: model:ir.model.fields.selection,name:sql_export_excel.selection__sql_export__file_format__excel +msgid "Excel" +msgstr "" + +#. module: sql_export_excel +#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__attachment_id +msgid "Excel Template" +msgstr "" + +#. module: sql_export_excel +#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__file_format +msgid "File Format" +msgstr "" + +#. module: sql_export_excel +#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__header +msgid "Header" +msgstr "" + +#. module: sql_export_excel +#: model:ir.model.fields,help:sql_export_excel.field_sql_export__attachment_id +msgid "" +"If you configure an excel file (in xlsx format) here, the result of the query will be injected in it.\n" +"It is usefull to feed data in a excel file pre-configured with calculation" +msgstr "" + +#. module: sql_export_excel +#: model:ir.model.fields,help:sql_export_excel.field_sql_export__col_position +msgid "Indicate from which column the result of the query should be injected." +msgstr "" + +#. module: sql_export_excel +#: model:ir.model.fields,help:sql_export_excel.field_sql_export__row_position +msgid "Indicate from which row the result of the query should be injected." +msgstr "" + +#. module: sql_export_excel +#: model:ir.model.fields,help:sql_export_excel.field_sql_export__header +msgid "Indicate if the header should be exported to the file." +msgstr "" + +#. module: sql_export_excel +#: model:ir.model.fields,help:sql_export_excel.field_sql_export__sheet_position +msgid "" +"Indicate the sheet's position of the excel template where the result of the " +"sql query should be injected." +msgstr "" + +#. module: sql_export_excel +#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__row_position +msgid "Row Position" +msgstr "" + +#. module: sql_export_excel +#: model:ir.model,name:sql_export_excel.model_sql_export +msgid "SQL export" +msgstr "" + +#. module: sql_export_excel +#: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__sheet_position +msgid "Sheet Position" +msgstr "" + +#. module: sql_export_excel +#: code:addons/sql_export_excel/models/sql_export.py:0 +#, python-format +msgid "" +"The Excel Template file contains less than %s sheets Please, adjust the " +"Sheet Position parameter." +msgstr "" + +#. module: sql_export_excel +#: code:addons/sql_export_excel/models/sql_export.py:0 +#, python-format +msgid "The column position can't be less than 1." +msgstr "" + +#. module: sql_export_excel +#: code:addons/sql_export_excel/models/sql_export.py:0 +#, python-format +msgid "The row position can't be less than 1." +msgstr "" + +#. module: sql_export_excel +#: code:addons/sql_export_excel/models/sql_export.py:0 +#, python-format +msgid "The sheet position can't be less than 1." +msgstr "" From b92efbc95fe63e1c1bb1799bc90c2c6b454f8d6b Mon Sep 17 00:00:00 2001 From: jabelchi Date: Wed, 15 Jun 2022 15:47:00 +0000 Subject: [PATCH 19/34] Translated using Weblate (Catalan) Currently translated at 100.0% (17 of 17 strings) Translation: reporting-engine-15.0/reporting-engine-15.0-sql_export_excel Translate-URL: https://translation.odoo-community.org/projects/reporting-engine-15-0/reporting-engine-15-0-sql_export_excel/ca/ --- sql_export_excel/i18n/ca.po | 38 ++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/sql_export_excel/i18n/ca.po b/sql_export_excel/i18n/ca.po index c9b37708da..8f64f3b39b 100644 --- a/sql_export_excel/i18n/ca.po +++ b/sql_export_excel/i18n/ca.po @@ -6,38 +6,40 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 15.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: Automatically generated\n" +"PO-Revision-Date: 2022-06-15 18:05+0000\n" +"Last-Translator: jabelchi \n" "Language-Team: none\n" "Language: ca\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" #. module: sql_export_excel #: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__col_position msgid "Column Position" -msgstr "" +msgstr "Posició columna" #. module: sql_export_excel #: model:ir.model.fields.selection,name:sql_export_excel.selection__sql_export__file_format__excel msgid "Excel" -msgstr "" +msgstr "Excel" #. module: sql_export_excel #: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__attachment_id msgid "Excel Template" -msgstr "" +msgstr "Plantilla Excel" #. module: sql_export_excel #: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__file_format msgid "File Format" -msgstr "" +msgstr "Format de fitxer" #. module: sql_export_excel #: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__header msgid "Header" -msgstr "" +msgstr "Capçalera" #. module: sql_export_excel #: model:ir.model.fields,help:sql_export_excel.field_sql_export__attachment_id @@ -45,21 +47,27 @@ msgid "" "If you configure an excel file (in xlsx format) here, the result of the query will be injected in it.\n" "It is usefull to feed data in a excel file pre-configured with calculation" msgstr "" +"Si configureu aquí un fitxer Excel (en format xlsx), s'hi injectarà el " +"resultat de la consulta.\n" +"Això és útil per a carregar dades en un fitxer Excel pre-configurat amb " +"càlculs" #. module: sql_export_excel #: model:ir.model.fields,help:sql_export_excel.field_sql_export__col_position msgid "Indicate from which column the result of the query should be injected." msgstr "" +"Indiqueu des de quina columna ha de carregar-se el resultat de la consulta." #. module: sql_export_excel #: model:ir.model.fields,help:sql_export_excel.field_sql_export__row_position msgid "Indicate from which row the result of the query should be injected." msgstr "" +"Indiqueu des de quina fila ha de carregar-se el resultat de la consulta." #. module: sql_export_excel #: model:ir.model.fields,help:sql_export_excel.field_sql_export__header msgid "Indicate if the header should be exported to the file." -msgstr "" +msgstr "Indiqueu si la capçalera ha d'exportar-se al fitxer." #. module: sql_export_excel #: model:ir.model.fields,help:sql_export_excel.field_sql_export__sheet_position @@ -67,21 +75,23 @@ msgid "" "Indicate the sheet's position of the excel template where the result of the " "sql query should be injected." msgstr "" +"Indiqueu la posició del full de la plantilla Excel on s'ha de carregar el " +"resultat de la consulta SQL." #. module: sql_export_excel #: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__row_position msgid "Row Position" -msgstr "" +msgstr "Posició fila" #. module: sql_export_excel #: model:ir.model,name:sql_export_excel.model_sql_export msgid "SQL export" -msgstr "" +msgstr "Exportació SQL" #. module: sql_export_excel #: model:ir.model.fields,field_description:sql_export_excel.field_sql_export__sheet_position msgid "Sheet Position" -msgstr "" +msgstr "Posició del full" #. module: sql_export_excel #: code:addons/sql_export_excel/models/sql_export.py:0 @@ -90,21 +100,23 @@ msgid "" "The Excel Template file contains less than %s sheets Please, adjust the " "Sheet Position parameter." msgstr "" +"La plantilla Excel conté menys de %s fulls. Si us plau, corregiu el " +"paràmetre de la posició del full." #. module: sql_export_excel #: code:addons/sql_export_excel/models/sql_export.py:0 #, python-format msgid "The column position can't be less than 1." -msgstr "" +msgstr "La posició de la columna no pot ser menor que 1." #. module: sql_export_excel #: code:addons/sql_export_excel/models/sql_export.py:0 #, python-format msgid "The row position can't be less than 1." -msgstr "" +msgstr "La posició de la fila no pot ser menor que 1." #. module: sql_export_excel #: code:addons/sql_export_excel/models/sql_export.py:0 #, python-format msgid "The sheet position can't be less than 1." -msgstr "" +msgstr "La posició del full no pot ser menor que 1." From 0ee4b2ac038f28422cc51f5405611113af137354 Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Tue, 13 Dec 2022 21:04:35 +0100 Subject: [PATCH 20/34] [16.0][MIG] sql_export_excel : migration to v16 --- sql_export_excel/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql_export_excel/__manifest__.py b/sql_export_excel/__manifest__.py index 99d3063eb0..6fc1f0c99c 100644 --- a/sql_export_excel/__manifest__.py +++ b/sql_export_excel/__manifest__.py @@ -3,7 +3,7 @@ { "name": "SQL Export Excel", - "version": "15.0.1.0.0", + "version": "16.0.1.0.0", "author": "Akretion,Odoo Community Association (OCA)", "website": "https://github.com/OCA/reporting-engine", "license": "AGPL-3", From 7e4019c9b30ba7140cd23e1babb82a1ebab2dc49 Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Fri, 3 Mar 2023 10:05:02 +0100 Subject: [PATCH 21/34] [FIX] Manage jsonb fields --- sql_export_excel/models/sql_export.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sql_export_excel/models/sql_export.py b/sql_export_excel/models/sql_export.py index 53cde9f076..68194c52ec 100644 --- a/sql_export_excel/models/sql_export.py +++ b/sql_export_excel/models/sql_export.py @@ -110,6 +110,9 @@ def excel_get_data_from_query(self, variable_dict): col_position = 1 for index, row in enumerate(res, row_position): for col, val in enumerate(row, col_position): + # manage jsonb field as dict are not writable on the excel cell + if isinstance(val, dict): + val = str(val) ws.cell(row=index, column=col).value = val output = BytesIO() wb.save(output) From 06749d1652758658e001e96c49dfaf43e29416bc Mon Sep 17 00:00:00 2001 From: oca-ci Date: Mon, 25 Sep 2023 10:13:41 +0000 Subject: [PATCH 22/34] [UPD] Update sql_export_excel.pot --- sql_export_excel/i18n/sql_export_excel.pot | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sql_export_excel/i18n/sql_export_excel.pot b/sql_export_excel/i18n/sql_export_excel.pot index ce27a4f1f5..f9758ca58f 100644 --- a/sql_export_excel/i18n/sql_export_excel.pot +++ b/sql_export_excel/i18n/sql_export_excel.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 15.0\n" +"Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -83,6 +83,7 @@ msgid "Sheet Position" msgstr "" #. module: sql_export_excel +#. odoo-python #: code:addons/sql_export_excel/models/sql_export.py:0 #, python-format msgid "" @@ -91,18 +92,21 @@ msgid "" msgstr "" #. module: sql_export_excel +#. odoo-python #: code:addons/sql_export_excel/models/sql_export.py:0 #, python-format msgid "The column position can't be less than 1." msgstr "" #. module: sql_export_excel +#. odoo-python #: code:addons/sql_export_excel/models/sql_export.py:0 #, python-format msgid "The row position can't be less than 1." msgstr "" #. module: sql_export_excel +#. odoo-python #: code:addons/sql_export_excel/models/sql_export.py:0 #, python-format msgid "The sheet position can't be less than 1." From ad056f7e3f2ab8291b6e604f93aa4a789db90a0c Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Mon, 25 Sep 2023 10:18:02 +0000 Subject: [PATCH 23/34] [BOT] post-merge updates --- sql_export_excel/README.rst | 23 +++++----- sql_export_excel/__manifest__.py | 2 +- .../static/description/index.html | 42 ++++++++++--------- 3 files changed, 36 insertions(+), 31 deletions(-) diff --git a/sql_export_excel/README.rst b/sql_export_excel/README.rst index db81423417..7905a883b8 100644 --- a/sql_export_excel/README.rst +++ b/sql_export_excel/README.rst @@ -2,10 +2,13 @@ SQL Export Excel ================ -.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:140000da7d6e4acfcacee34bf261cfa64e2d76d8e01e4aaccfc11cf3bc93b288 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status @@ -14,16 +17,16 @@ SQL Export Excel :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github - :target: https://github.com/OCA/reporting-engine/tree/15.0/sql_export_excel + :target: https://github.com/OCA/reporting-engine/tree/16.0/sql_export_excel :alt: OCA/reporting-engine .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/reporting-engine-15-0/reporting-engine-15-0-sql_export_excel + :target: https://translation.odoo-community.org/projects/reporting-engine-16-0/reporting-engine-16-0-sql_export_excel :alt: Translate me on Weblate -.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/143/15.0 - :alt: Try me on Runbot +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&target_branch=16.0 + :alt: Try me on Runboat -|badge1| |badge2| |badge3| |badge4| |badge5| +|badge1| |badge2| |badge3| |badge4| |badge5| Add the possibility to extract data from a sql query toward an excel file. It is also possible to provide an template excel file for a query. In this case, @@ -48,8 +51,8 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. -If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -80,6 +83,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/reporting-engine `_ project on GitHub. +This module is part of the `OCA/reporting-engine `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sql_export_excel/__manifest__.py b/sql_export_excel/__manifest__.py index 6fc1f0c99c..89816b0db0 100644 --- a/sql_export_excel/__manifest__.py +++ b/sql_export_excel/__manifest__.py @@ -3,7 +3,7 @@ { "name": "SQL Export Excel", - "version": "16.0.1.0.0", + "version": "16.0.1.0.1", "author": "Akretion,Odoo Community Association (OCA)", "website": "https://github.com/OCA/reporting-engine", "license": "AGPL-3", diff --git a/sql_export_excel/static/description/index.html b/sql_export_excel/static/description/index.html index 1b0f536af5..9814e15017 100644 --- a/sql_export_excel/static/description/index.html +++ b/sql_export_excel/static/description/index.html @@ -1,20 +1,20 @@ - + - + SQL Export Excel -

-

SQL Export Excel

+
+ + +Odoo Community Association + +
+

SQL Export Excel

-

Beta License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runboat

Add the possibility to extract data from a sql query toward an excel file. It is also possible to provide an template excel file for a query. In this case, the data will be inserted in the specified sheet of the @@ -389,7 +394,7 @@

SQL Export Excel

-

Configuration

+

Configuration

If you want Odoo to update an existing excel file, you should create an attachment with the excel file and configure this attachment on the query. Then, you can configure the query to indicate if Odoo should @@ -397,30 +402,30 @@

Configuration

will insert it in the first sheet, at first row/column.

-

Bug Tracker

+

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

-

Authors

+

Authors

  • Akretion
-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association @@ -430,10 +435,11 @@

Maintainers

promote its widespread use.

Current maintainer:

florian-dacosta

-

This module is part of the OCA/reporting-engine project on GitHub.

+

This module is part of the OCA/reporting-engine project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+