diff --git a/survey_export_xlsx/README.rst b/survey_export_xlsx/README.rst new file mode 100644 index 000000000..da9028254 --- /dev/null +++ b/survey_export_xlsx/README.rst @@ -0,0 +1,49 @@ +.. image:: https://img.shields.io/badge/licence-LGPL--3-green.svg + :target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 + +Survey XLSX Report +================== +This module helps to export survey answers in XLSX format. + +Configuration +============= +Nothing to configure. + +License +------- +Lesser General Public License, Version 3 (LGPL v3) +(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +Developer: (V18) Busthana Shirin, + (V17) Ajith V, + (V16) Albin P J, Contact: odoo@cybrosys.com + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com +* Website : https://cybrosys.com + +Bug Tracker +----------- +Bugs are tracked on GitHub Issues. In case of trouble, please check there if +your issue has already been reported. + +Maintainer +========== +.. image:: https://cybrosys.com/images/logo.png + :target: https://cybrosys.com + +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit `Our Website `__ + +Further information +=================== +HTML Description: ``__ diff --git a/survey_export_xlsx/__init__.py b/survey_export_xlsx/__init__.py new file mode 100644 index 000000000..8feeafed8 --- /dev/null +++ b/survey_export_xlsx/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +################################################################################ +from . import controllers +from . import models +from . import wizard diff --git a/survey_export_xlsx/__manifest__.py b/survey_export_xlsx/__manifest__.py new file mode 100644 index 000000000..d9d39db96 --- /dev/null +++ b/survey_export_xlsx/__manifest__.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +################################################################################ +{ + 'name': 'Survey XLSX Report', + 'version': '18.0.1.0.0', + 'category': 'Extra Tools', + 'summary': """This module helps to export survey answers in XLS format""", + 'description': """This module helps to export survey answers in XLS format. + You can easily get the questions and answers of the + corresponding user""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'depends': ['base', 'survey', 'contacts'], + 'data': [ + 'security/ir.model.access.csv', + 'data/ir_action_data.xml', + 'wizard/survey_xlsx_report_views.xml', + ], + 'assets': { + 'web.assets_backend': [ + 'survey_export_xlsx/static/src/js/action_manager.js'] + }, + 'images': ['static/description/banner.jpg'], + 'license': 'LGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/survey_export_xlsx/controllers/__init__.py b/survey_export_xlsx/controllers/__init__.py new file mode 100644 index 000000000..9c0502e39 --- /dev/null +++ b/survey_export_xlsx/controllers/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +################################################################################ +from . import survey_export_xlsx diff --git a/survey_export_xlsx/controllers/survey_export_xlsx.py b/survey_export_xlsx/controllers/survey_export_xlsx.py new file mode 100644 index 000000000..b2605d4ff --- /dev/null +++ b/survey_export_xlsx/controllers/survey_export_xlsx.py @@ -0,0 +1,90 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +################################################################################ +import json +from odoo import http +from odoo.http import content_disposition, request, serialize_exception as \ + _serialize_exception +from odoo.tools import html_escape + + +class SurveyXlsReportController(http.Controller): + """This is used for get the xlsx report""" + + @http.route('/xlsx_reports', type='http', auth='user', + methods=['POST'], csrf=False) + def get_report_xlsx(self, model, options, output_format, report_name): + """ + Generate and return an XLSX report for the specified model. + + This method handles the HTTP POST request to generate an XLSX report + based on the provided model and options. The report is generated using + the custom `get_xlsx_report` method of the specified model and returned + as an HTTP response. + + Args: + model (str): The name of the model for which the report is to be + generated. + options (str): A JSON string containing the options for generating + the report, It is parsed into a Python dictionary before being + passed to the report generation method. + output_format (str): The format of the output report. + This method currently only supports 'xlsx'. + report_name (str): The desired name of the generated report file. + Returns: + Response: An HTTP response containing the generated XLSX report. + If an error occurs during the report generation, an error + response is returned with the exception details. + + Raises: + Exception: If there is any issue during the report generation, it is + caught and returned as a JSON response with an error message. + + Note: + - This route is accessible to authenticated users only. + - CSRF protection is disabled for this route. + - A dummy token is set in the response cookies to meet API + expectations. + """ + uid = request.session.uid + report_obj = request.env[model].with_user(uid) + options = json.loads(options) + token = 'dummy-because-api-expects-one' + try: + if output_format == 'xlsx': + response = request.make_response( + None, + headers=[ + ('Content-Type', 'application/vnd.ms-excel'), + ('Content-Disposition', + content_disposition(report_name + '.xlsx')) + ] + ) + report_obj.get_xlsx_report(options, response) + response.set_cookie('fileToken', token) + return response + except Exception as e: + error = { + 'code': 200, + 'message': 'Odoo Server Error', + 'data': _serialize_exception(e) + } + return request.make_response(html_escape(json.dumps(error))) diff --git a/survey_export_xlsx/data/ir_action_data.xml b/survey_export_xlsx/data/ir_action_data.xml new file mode 100644 index 000000000..d70b66707 --- /dev/null +++ b/survey_export_xlsx/data/ir_action_data.xml @@ -0,0 +1,26 @@ + + + + + + Survey XLSX Report + + + code + + action = records.action_print_xlsx_report() + + + + diff --git a/survey_export_xlsx/doc/RELEASE_NOTES.md b/survey_export_xlsx/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..ea6e781af --- /dev/null +++ b/survey_export_xlsx/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 17.07.2025 +#### Version 18.0.1.0.0 +#### ADD + +- Initial commit for Survey XLSX Report diff --git a/survey_export_xlsx/models/__init__.py b/survey_export_xlsx/models/__init__.py new file mode 100644 index 000000000..726c93e2e --- /dev/null +++ b/survey_export_xlsx/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +################################################################################ +from . import survey_survey diff --git a/survey_export_xlsx/models/survey_survey.py b/survey_export_xlsx/models/survey_survey.py new file mode 100644 index 000000000..a737c5cd1 --- /dev/null +++ b/survey_export_xlsx/models/survey_survey.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +################################################################################ +from odoo import models + + +class Survey(models.Model): + """This will return the wizard""" + _inherit = 'survey.survey' + + def action_print_xlsx_report(self): + """Returning the wizard for filtering the report""" + return { + 'name': 'Survey Answer XLSX Report', + 'res_model': 'survey.xlsx.report', + 'view_mode': 'form', + 'view_type': 'form', + 'type': 'ir.actions.act_window', + 'target': 'new', + 'context': {'default_survey_ids': self.ids}, + } diff --git a/survey_export_xlsx/security/ir.model.access.csv b/survey_export_xlsx/security/ir.model.access.csv new file mode 100644 index 000000000..961c3e40c --- /dev/null +++ b/survey_export_xlsx/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_survey_xlsx_report_user,access.survey.xlsx.report.user,model_survey_xlsx_report,base.group_user,1,1,1,1 diff --git a/survey_export_xlsx/static/description/assets/cybro-icon.png b/survey_export_xlsx/static/description/assets/cybro-icon.png new file mode 100755 index 000000000..06e73e11d Binary files /dev/null and b/survey_export_xlsx/static/description/assets/cybro-icon.png differ diff --git a/survey_export_xlsx/static/description/assets/cybro-odoo.png b/survey_export_xlsx/static/description/assets/cybro-odoo.png new file mode 100755 index 000000000..ed02e07a4 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/cybro-odoo.png differ diff --git a/survey_export_xlsx/static/description/assets/h2.png b/survey_export_xlsx/static/description/assets/h2.png new file mode 100755 index 000000000..0bfc4707d Binary files /dev/null and b/survey_export_xlsx/static/description/assets/h2.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/arrows-repeat.svg b/survey_export_xlsx/static/description/assets/icons/arrows-repeat.svg new file mode 100755 index 000000000..1d7efabc5 --- /dev/null +++ b/survey_export_xlsx/static/description/assets/icons/arrows-repeat.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/survey_export_xlsx/static/description/assets/icons/banner-1.png b/survey_export_xlsx/static/description/assets/icons/banner-1.png new file mode 100755 index 000000000..c180db172 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/banner-1.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/banner-2.svg b/survey_export_xlsx/static/description/assets/icons/banner-2.svg new file mode 100755 index 000000000..e606d97d9 --- /dev/null +++ b/survey_export_xlsx/static/description/assets/icons/banner-2.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/survey_export_xlsx/static/description/assets/icons/banner-bg.png b/survey_export_xlsx/static/description/assets/icons/banner-bg.png new file mode 100755 index 000000000..a8238d3c0 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/banner-bg.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/banner-bg.svg b/survey_export_xlsx/static/description/assets/icons/banner-bg.svg new file mode 100755 index 000000000..b1378103e --- /dev/null +++ b/survey_export_xlsx/static/description/assets/icons/banner-bg.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/survey_export_xlsx/static/description/assets/icons/banner-call.svg b/survey_export_xlsx/static/description/assets/icons/banner-call.svg new file mode 100755 index 000000000..96c687e81 --- /dev/null +++ b/survey_export_xlsx/static/description/assets/icons/banner-call.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/survey_export_xlsx/static/description/assets/icons/banner-mail.svg b/survey_export_xlsx/static/description/assets/icons/banner-mail.svg new file mode 100755 index 000000000..cbf0d158d --- /dev/null +++ b/survey_export_xlsx/static/description/assets/icons/banner-mail.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/survey_export_xlsx/static/description/assets/icons/banner-pattern.svg b/survey_export_xlsx/static/description/assets/icons/banner-pattern.svg new file mode 100755 index 000000000..9c1c7e101 --- /dev/null +++ b/survey_export_xlsx/static/description/assets/icons/banner-pattern.svg @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/survey_export_xlsx/static/description/assets/icons/banner-promo.svg b/survey_export_xlsx/static/description/assets/icons/banner-promo.svg new file mode 100755 index 000000000..d52791b11 --- /dev/null +++ b/survey_export_xlsx/static/description/assets/icons/banner-promo.svg @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/survey_export_xlsx/static/description/assets/icons/brand-pair.svg b/survey_export_xlsx/static/description/assets/icons/brand-pair.svg new file mode 100755 index 000000000..d8db7fc1e --- /dev/null +++ b/survey_export_xlsx/static/description/assets/icons/brand-pair.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/survey_export_xlsx/static/description/assets/icons/check.png b/survey_export_xlsx/static/description/assets/icons/check.png new file mode 100755 index 000000000..c8e85f51d Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/check.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/chevron.png b/survey_export_xlsx/static/description/assets/icons/chevron.png new file mode 100755 index 000000000..2089293d6 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/chevron.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/close-icon.svg b/survey_export_xlsx/static/description/assets/icons/close-icon.svg new file mode 100755 index 000000000..df8cce37a --- /dev/null +++ b/survey_export_xlsx/static/description/assets/icons/close-icon.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/survey_export_xlsx/static/description/assets/icons/cogs.png b/survey_export_xlsx/static/description/assets/icons/cogs.png new file mode 100755 index 000000000..95d0bad62 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/cogs.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/collabarate-icon.svg b/survey_export_xlsx/static/description/assets/icons/collabarate-icon.svg new file mode 100755 index 000000000..dd4e10518 --- /dev/null +++ b/survey_export_xlsx/static/description/assets/icons/collabarate-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/survey_export_xlsx/static/description/assets/icons/consultation.png b/survey_export_xlsx/static/description/assets/icons/consultation.png new file mode 100755 index 000000000..8319d4baa Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/consultation.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/cybro-logo.png b/survey_export_xlsx/static/description/assets/icons/cybro-logo.png new file mode 100755 index 000000000..ff4b78220 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/cybro-logo.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/down.svg b/survey_export_xlsx/static/description/assets/icons/down.svg new file mode 100755 index 000000000..f21c36271 --- /dev/null +++ b/survey_export_xlsx/static/description/assets/icons/down.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/survey_export_xlsx/static/description/assets/icons/ecom-black.png b/survey_export_xlsx/static/description/assets/icons/ecom-black.png new file mode 100755 index 000000000..a9385ff13 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/ecom-black.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/education-black.png b/survey_export_xlsx/static/description/assets/icons/education-black.png new file mode 100755 index 000000000..3eb09b27b Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/education-black.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/faq.png b/survey_export_xlsx/static/description/assets/icons/faq.png new file mode 100755 index 000000000..4250b5b81 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/faq.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/feature-icon.svg b/survey_export_xlsx/static/description/assets/icons/feature-icon.svg new file mode 100755 index 000000000..fa0ea6850 --- /dev/null +++ b/survey_export_xlsx/static/description/assets/icons/feature-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/survey_export_xlsx/static/description/assets/icons/feature.png b/survey_export_xlsx/static/description/assets/icons/feature.png new file mode 100755 index 000000000..ac7a785c0 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/feature.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/gear.svg b/survey_export_xlsx/static/description/assets/icons/gear.svg new file mode 100755 index 000000000..0cc66b6ea --- /dev/null +++ b/survey_export_xlsx/static/description/assets/icons/gear.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/survey_export_xlsx/static/description/assets/icons/hero.gif b/survey_export_xlsx/static/description/assets/icons/hero.gif new file mode 100644 index 000000000..ccb79471f Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/hero.gif differ diff --git a/survey_export_xlsx/static/description/assets/icons/hire-odoo.svg b/survey_export_xlsx/static/description/assets/icons/hire-odoo.svg new file mode 100755 index 000000000..e1ac089b0 --- /dev/null +++ b/survey_export_xlsx/static/description/assets/icons/hire-odoo.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/survey_export_xlsx/static/description/assets/icons/hotel-black.png b/survey_export_xlsx/static/description/assets/icons/hotel-black.png new file mode 100755 index 000000000..130f613be Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/hotel-black.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/license.png b/survey_export_xlsx/static/description/assets/icons/license.png new file mode 100755 index 000000000..a5869797e Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/license.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/life-ring-icon.svg b/survey_export_xlsx/static/description/assets/icons/life-ring-icon.svg new file mode 100755 index 000000000..3ae6e1d89 --- /dev/null +++ b/survey_export_xlsx/static/description/assets/icons/life-ring-icon.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/survey_export_xlsx/static/description/assets/icons/lifebuoy.png b/survey_export_xlsx/static/description/assets/icons/lifebuoy.png new file mode 100755 index 000000000..658d56ccc Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/lifebuoy.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/mail.svg b/survey_export_xlsx/static/description/assets/icons/mail.svg new file mode 100755 index 000000000..1eedde695 --- /dev/null +++ b/survey_export_xlsx/static/description/assets/icons/mail.svg @@ -0,0 +1,3 @@ + + + diff --git a/survey_export_xlsx/static/description/assets/icons/manufacturing-black.png b/survey_export_xlsx/static/description/assets/icons/manufacturing-black.png new file mode 100755 index 000000000..697eb0e9f Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/manufacturing-black.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/notes.png b/survey_export_xlsx/static/description/assets/icons/notes.png new file mode 100755 index 000000000..ee5e95404 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/notes.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/notification icon.svg b/survey_export_xlsx/static/description/assets/icons/notification icon.svg new file mode 100755 index 000000000..053189973 --- /dev/null +++ b/survey_export_xlsx/static/description/assets/icons/notification icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/survey_export_xlsx/static/description/assets/icons/odoo-consultancy.svg b/survey_export_xlsx/static/description/assets/icons/odoo-consultancy.svg new file mode 100755 index 000000000..e05f65bde --- /dev/null +++ b/survey_export_xlsx/static/description/assets/icons/odoo-consultancy.svg @@ -0,0 +1,4 @@ + + + + diff --git a/survey_export_xlsx/static/description/assets/icons/odoo-licencing.svg b/survey_export_xlsx/static/description/assets/icons/odoo-licencing.svg new file mode 100755 index 000000000..2606c88b0 --- /dev/null +++ b/survey_export_xlsx/static/description/assets/icons/odoo-licencing.svg @@ -0,0 +1,3 @@ + + + diff --git a/survey_export_xlsx/static/description/assets/icons/odoo-logo.png b/survey_export_xlsx/static/description/assets/icons/odoo-logo.png new file mode 100755 index 000000000..0e4d0eb5a Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/odoo-logo.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/patter.svg b/survey_export_xlsx/static/description/assets/icons/patter.svg new file mode 100755 index 000000000..25c9c0a8f --- /dev/null +++ b/survey_export_xlsx/static/description/assets/icons/patter.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/survey_export_xlsx/static/description/assets/icons/pattern1.png b/survey_export_xlsx/static/description/assets/icons/pattern1.png new file mode 100755 index 000000000..09ab0fb2d Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/pattern1.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/pos-black.png b/survey_export_xlsx/static/description/assets/icons/pos-black.png new file mode 100755 index 000000000..97c0f90c1 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/pos-black.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/puzzle-piece-icon.svg b/survey_export_xlsx/static/description/assets/icons/puzzle-piece-icon.svg new file mode 100755 index 000000000..3e9ad9373 --- /dev/null +++ b/survey_export_xlsx/static/description/assets/icons/puzzle-piece-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/survey_export_xlsx/static/description/assets/icons/puzzle.png b/survey_export_xlsx/static/description/assets/icons/puzzle.png new file mode 100755 index 000000000..65cf854e7 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/puzzle.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/replace-icon.svg b/survey_export_xlsx/static/description/assets/icons/replace-icon.svg new file mode 100755 index 000000000..d0e3a7af1 --- /dev/null +++ b/survey_export_xlsx/static/description/assets/icons/replace-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/survey_export_xlsx/static/description/assets/icons/restaurant-black.png b/survey_export_xlsx/static/description/assets/icons/restaurant-black.png new file mode 100755 index 000000000..4a35eb939 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/restaurant-black.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/screenshot-main.png b/survey_export_xlsx/static/description/assets/icons/screenshot-main.png new file mode 100755 index 000000000..575f8e676 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/screenshot-main.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/screenshot.png b/survey_export_xlsx/static/description/assets/icons/screenshot.png new file mode 100755 index 000000000..cef272529 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/screenshot.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/service-black.png b/survey_export_xlsx/static/description/assets/icons/service-black.png new file mode 100755 index 000000000..301ab51cb Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/service-black.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/skype-fill.svg b/survey_export_xlsx/static/description/assets/icons/skype-fill.svg new file mode 100755 index 000000000..c17423639 --- /dev/null +++ b/survey_export_xlsx/static/description/assets/icons/skype-fill.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/survey_export_xlsx/static/description/assets/icons/skype.png b/survey_export_xlsx/static/description/assets/icons/skype.png new file mode 100755 index 000000000..51b409fb3 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/skype.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/skype.svg b/survey_export_xlsx/static/description/assets/icons/skype.svg new file mode 100755 index 000000000..df3dad39b --- /dev/null +++ b/survey_export_xlsx/static/description/assets/icons/skype.svg @@ -0,0 +1,3 @@ + + + diff --git a/survey_export_xlsx/static/description/assets/icons/star-1.svg b/survey_export_xlsx/static/description/assets/icons/star-1.svg new file mode 100755 index 000000000..7e55ab162 --- /dev/null +++ b/survey_export_xlsx/static/description/assets/icons/star-1.svg @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/survey_export_xlsx/static/description/assets/icons/star-2.svg b/survey_export_xlsx/static/description/assets/icons/star-2.svg new file mode 100755 index 000000000..5ae9f507a --- /dev/null +++ b/survey_export_xlsx/static/description/assets/icons/star-2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/survey_export_xlsx/static/description/assets/icons/support.png b/survey_export_xlsx/static/description/assets/icons/support.png new file mode 100755 index 000000000..4f18b8b82 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/support.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/test-1 - Copy.png b/survey_export_xlsx/static/description/assets/icons/test-1 - Copy.png new file mode 100755 index 000000000..f6a902663 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/test-1 - Copy.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/test-1.png b/survey_export_xlsx/static/description/assets/icons/test-1.png new file mode 100755 index 000000000..0908add2b Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/test-1.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/test-2.png b/survey_export_xlsx/static/description/assets/icons/test-2.png new file mode 100755 index 000000000..4671fe91e Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/test-2.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/trading-black.png b/survey_export_xlsx/static/description/assets/icons/trading-black.png new file mode 100755 index 000000000..9398ba2f1 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/trading-black.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/training.png b/survey_export_xlsx/static/description/assets/icons/training.png new file mode 100755 index 000000000..884ca024d Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/training.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/translate.svg b/survey_export_xlsx/static/description/assets/icons/translate.svg new file mode 100755 index 000000000..af9c8a1aa --- /dev/null +++ b/survey_export_xlsx/static/description/assets/icons/translate.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/survey_export_xlsx/static/description/assets/icons/update.png b/survey_export_xlsx/static/description/assets/icons/update.png new file mode 100755 index 000000000..ecbc5a01a Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/update.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/user.png b/survey_export_xlsx/static/description/assets/icons/user.png new file mode 100755 index 000000000..6ffb23d9f Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/user.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/video.png b/survey_export_xlsx/static/description/assets/icons/video.png new file mode 100755 index 000000000..576705b17 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/video.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/whatsapp.png b/survey_export_xlsx/static/description/assets/icons/whatsapp.png new file mode 100755 index 000000000..d513a5356 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/whatsapp.png differ diff --git a/survey_export_xlsx/static/description/assets/icons/wrench-icon.svg b/survey_export_xlsx/static/description/assets/icons/wrench-icon.svg new file mode 100755 index 000000000..174b5a465 --- /dev/null +++ b/survey_export_xlsx/static/description/assets/icons/wrench-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/survey_export_xlsx/static/description/assets/icons/wrench.png b/survey_export_xlsx/static/description/assets/icons/wrench.png new file mode 100755 index 000000000..6c04dea0f Binary files /dev/null and b/survey_export_xlsx/static/description/assets/icons/wrench.png differ diff --git a/survey_export_xlsx/static/description/assets/modules/1.jpg b/survey_export_xlsx/static/description/assets/modules/1.jpg new file mode 100644 index 000000000..3cb15fe01 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/modules/1.jpg differ diff --git a/survey_export_xlsx/static/description/assets/modules/2.jpg b/survey_export_xlsx/static/description/assets/modules/2.jpg new file mode 100644 index 000000000..662cadcc3 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/modules/2.jpg differ diff --git a/survey_export_xlsx/static/description/assets/modules/3.jpg b/survey_export_xlsx/static/description/assets/modules/3.jpg new file mode 100644 index 000000000..717a00443 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/modules/3.jpg differ diff --git a/survey_export_xlsx/static/description/assets/modules/4.png b/survey_export_xlsx/static/description/assets/modules/4.png new file mode 100644 index 000000000..00ebf54ad Binary files /dev/null and b/survey_export_xlsx/static/description/assets/modules/4.png differ diff --git a/survey_export_xlsx/static/description/assets/modules/5.jpg b/survey_export_xlsx/static/description/assets/modules/5.jpg new file mode 100644 index 000000000..7c67e2eec Binary files /dev/null and b/survey_export_xlsx/static/description/assets/modules/5.jpg differ diff --git a/survey_export_xlsx/static/description/assets/modules/6.gif b/survey_export_xlsx/static/description/assets/modules/6.gif new file mode 100644 index 000000000..a35ece8df Binary files /dev/null and b/survey_export_xlsx/static/description/assets/modules/6.gif differ diff --git a/survey_export_xlsx/static/description/assets/screenshots/1.png b/survey_export_xlsx/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..045fb0b6a Binary files /dev/null and b/survey_export_xlsx/static/description/assets/screenshots/1.png differ diff --git a/survey_export_xlsx/static/description/assets/screenshots/2.png b/survey_export_xlsx/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..73794fd9d Binary files /dev/null and b/survey_export_xlsx/static/description/assets/screenshots/2.png differ diff --git a/survey_export_xlsx/static/description/assets/screenshots/3.png b/survey_export_xlsx/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..e329bd84a Binary files /dev/null and b/survey_export_xlsx/static/description/assets/screenshots/3.png differ diff --git a/survey_export_xlsx/static/description/assets/screenshots/4.png b/survey_export_xlsx/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..9e1ed6ffc Binary files /dev/null and b/survey_export_xlsx/static/description/assets/screenshots/4.png differ diff --git a/survey_export_xlsx/static/description/assets/screenshots/5.png b/survey_export_xlsx/static/description/assets/screenshots/5.png new file mode 100644 index 000000000..06832c63b Binary files /dev/null and b/survey_export_xlsx/static/description/assets/screenshots/5.png differ diff --git a/survey_export_xlsx/static/description/assets/screenshots/6.png b/survey_export_xlsx/static/description/assets/screenshots/6.png new file mode 100644 index 000000000..387d96371 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/screenshots/6.png differ diff --git a/survey_export_xlsx/static/description/assets/screenshots/Gif.gif b/survey_export_xlsx/static/description/assets/screenshots/Gif.gif new file mode 100644 index 000000000..c13cafcb1 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/screenshots/Gif.gif differ diff --git a/survey_export_xlsx/static/description/assets/screenshots/hero.gif b/survey_export_xlsx/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..6974b08f8 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/screenshots/hero.gif differ diff --git a/survey_export_xlsx/static/description/assets/screenshots/survey.zip b/survey_export_xlsx/static/description/assets/screenshots/survey.zip new file mode 100644 index 000000000..c27baa50d Binary files /dev/null and b/survey_export_xlsx/static/description/assets/screenshots/survey.zip differ diff --git a/survey_export_xlsx/static/description/assets/screenshots/survey1.png b/survey_export_xlsx/static/description/assets/screenshots/survey1.png new file mode 100644 index 000000000..46f31b1db Binary files /dev/null and b/survey_export_xlsx/static/description/assets/screenshots/survey1.png differ diff --git a/survey_export_xlsx/static/description/assets/screenshots/survey2.png b/survey_export_xlsx/static/description/assets/screenshots/survey2.png new file mode 100644 index 000000000..ef229ece0 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/screenshots/survey2.png differ diff --git a/survey_export_xlsx/static/description/assets/screenshots/survey3.png b/survey_export_xlsx/static/description/assets/screenshots/survey3.png new file mode 100644 index 000000000..a7cf6485c Binary files /dev/null and b/survey_export_xlsx/static/description/assets/screenshots/survey3.png differ diff --git a/survey_export_xlsx/static/description/assets/screenshots/survey4.png b/survey_export_xlsx/static/description/assets/screenshots/survey4.png new file mode 100644 index 000000000..546ffaf5d Binary files /dev/null and b/survey_export_xlsx/static/description/assets/screenshots/survey4.png differ diff --git a/survey_export_xlsx/static/description/assets/y18.jpg b/survey_export_xlsx/static/description/assets/y18.jpg new file mode 100755 index 000000000..eea1714f2 Binary files /dev/null and b/survey_export_xlsx/static/description/assets/y18.jpg differ diff --git a/survey_export_xlsx/static/description/banner.jpg b/survey_export_xlsx/static/description/banner.jpg new file mode 100644 index 000000000..6d7190f7a Binary files /dev/null and b/survey_export_xlsx/static/description/banner.jpg differ diff --git a/survey_export_xlsx/static/description/icon.png b/survey_export_xlsx/static/description/icon.png new file mode 100644 index 000000000..0f11dedb8 Binary files /dev/null and b/survey_export_xlsx/static/description/icon.png differ diff --git a/survey_export_xlsx/static/description/index.html b/survey_export_xlsx/static/description/index.html new file mode 100644 index 000000000..1e5cd975d --- /dev/null +++ b/survey_export_xlsx/static/description/index.html @@ -0,0 +1,942 @@ + + + + + + Survey XLSX Report + + + + + + + + + + +
+
+ + + +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ +
+
+
+
+

+ This Module helps to Export Survey Answers in XLSX Format. + You can easily get the Questions and Answers of the + Corresponding User. +

+

Survey XLSX Report +

+
+
+ +
+ +
+ +
+
+
+ +
+
+ +
+
+ +
+
+
+

Key + Highlights

+
+
+
+
+ +
+
+ You can Filter the Survey Questions and Answers + based on User. +
+
+
+
+
+
+ +
+
+ You can get Questions and Answers in Tree/Form views. +
+
+
+
+
+
+ +
+
+ Also, You can get Filtered Reports of all Survey + Questions and Answers from the Tree view. +
+
+
+
+
+ +
+
+
+ Survey XLSX Report +

+ Are you ready to make your business more + organized? +
Improve now! +

+ +
+
+ +
+
+
+ + + + +
+
+ +
+
+
+
+ acc_bg +
+ +
+
+
+
+

+ Button In Tree View +

+
+
+
+ +
+
+
+
+
+
+
+
+
+

+ Button In Form View +

+
+
+
+ +
+
+
+
+
+
+
+
+
+

+ Get User Specific Report +

+
+
+

+ You can see the option to add users. Also, + you can add a user, and it will give a + survey questions and answers based on the + user. +

+
+
+
+ +
+
+
+
+
+
+
+
+
+

+ Get All Users Report +

+
+
+

+ you will get survey questions and answers from all users. +

+
+
+
+ +
+
+
+
+
+
+
+
+
+

+ Survey XLSX Reports +

+
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+
+
+ +
+

+ You can Filter + the Survey Questions and Answers based on User.

+
+ +
+
+
+
+
+
+ +
+

+ You can get Questions and Answers in Tree/Form views.

+
+
+
+
+
+
+ +
+

+ Also, You can + get Filtered Reports of all Survey Questions and + Answers from the Tree view.

+
+
+
+
+
+
+
+
+
+ +
+ +
+ +
+

+ Yes. it works with Odoosh. +

+
+
+
+ +
+
+
+
+
+
+ +
+
+

+ Latest Release 18.0.1.0.0 +

+ + 26th May 2025 + +
+
+
+
+
+ Add +
+
+
+
    +
  • + Initial Commit +
  • + +
+
+
+
+
+
+
+
+
+
+ + + +
+

+ Related Products +

+ +
+ + +
+

+ Our Services

+ +
+ +
+
+ .... +
+
+ +
+ + +
+
+ + + + + + diff --git a/survey_export_xlsx/static/src/js/action_manager.js b/survey_export_xlsx/static/src/js/action_manager.js new file mode 100644 index 000000000..0abe7f257 --- /dev/null +++ b/survey_export_xlsx/static/src/js/action_manager.js @@ -0,0 +1,16 @@ +/** @odoo-module **/ +import { registry } from "@web/core/registry"; +import { BlockUI } from "@web/core/ui/block_ui"; +import { download } from "@web/core/network/download"; +//this is used to call the controller and also passes the report data. +registry.category("ir.actions.report handlers").add("xlsx", async function (action) { + if (action.report_type === 'xlsx') { + BlockUI; + await download({ + url: '/xlsx_reports', + data: action.data, + complete: () => unblockUI, + error: (error) => this.call('crash_manager', 'rpc_error', error), + }); + } +}); diff --git a/survey_export_xlsx/wizard/__init__.py b/survey_export_xlsx/wizard/__init__.py new file mode 100644 index 000000000..88fbeee70 --- /dev/null +++ b/survey_export_xlsx/wizard/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +################################################################################ +from . import survey_xlsx_report diff --git a/survey_export_xlsx/wizard/survey_xlsx_report.py b/survey_export_xlsx/wizard/survey_xlsx_report.py new file mode 100644 index 000000000..ede18d129 --- /dev/null +++ b/survey_export_xlsx/wizard/survey_xlsx_report.py @@ -0,0 +1,243 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +################################################################################ +import io +import xlsxwriter +from odoo import api, fields, models, _ +from odoo.tools.safe_eval import json +from odoo.exceptions import ValidationError +from odoo.tools.json import json_default + + + +class SurveyXlsReport(models.TransientModel): + """This is the wizard model, We can filter the xls report using this + model""" + _name = 'survey.xlsx.report' + _description = 'Survey XLSX Report ' + + partner_id = fields.Many2one('res.partner', string="Partner", + help="Select for getting the report of the " + "user") + survey_ids = fields.Many2many('survey.survey', string="Survey Ids", + help="This field stores survey ids", + readonly=True) + + @api.onchange('partner_id') + def _onchange_partner_id(self): + """ + Updates the domain of the 'partner_id' field based on the partners + who have completed the associated surveys. + + This method iterates over the survey records linked to the current record + and searches for survey user inputs that are in a 'done' state. It collects + the partners associated with these completed surveys and sets the domain + for the 'partner_id' field accordingly. + + If no partners have completed the surveys, a ValidationError is raised. + + Raises: + ValidationError: If no partners have participated in the survey. + + Returns: + dict: A dictionary containing the domain for the 'partner_id' field, + limited to the IDs of partners who have completed the surveys. + """ + partner_ids = [] + for rec in self.survey_ids: + user_list = self.env['survey.user_input'].search( + [('survey_id', '=', rec._origin.id), ('state', '=', 'done')]) + for dec in user_list.partner_id: + if dec.id not in partner_ids: + partner_ids.append(dec.id) + if not partner_ids: + raise ValidationError(_( + "There are no partners participating in this survey")) + + return {'domain': {'partner_id': [('id', 'in', partner_ids)]}} + + def action_print_survey_xlsx_report(self): + """ + Generates and returns an XLSX report containing survey responses. + + This method is triggered by a button and compiles survey data into an + Excel file. It iterates through all linked surveys, filters completed + responses (in the 'done' state), and gathers relevant information such + as survey name, creation date, respondent's name, question title, and + corresponding answers. + + The collected data is organized by survey name and structured into a + dictionary format, which is then passed to the report generation process. + + If a specific partner is selected, the method filters the survey + responses to include only those from that partner. + + Returns: + dict: An action that triggers the generation of an XLSX report with + the compiled survey data. + + The returned action dictionary includes: + - 'type': Specifies the type of action (report generation). + - 'data': Contains model name, options (including the formatted survey data), + output format, and report name. + - 'report_type': Specifies the report type ('xlsx'). + """ + data_dict = {} + + for doc in self.survey_ids: + domain = [('survey_id', '=', doc.id), ('state', '=', 'done')] + if self.partner_id: + domain.append(('partner_id', '=', self.partner_id.id)) + for record in self.env['survey.user_input'].search(domain): + for rec in self.env['survey.user_input.line'].search( + [('user_input_id', '=', record.id)]): + data = { + 'survey_name': rec.survey_id.title, + 'create_date': rec.create_date, + 'user_name': rec.user_input_id.partner_id.name, + 'question': rec.question_id.title, + 'answer': rec.display_name, + } + # Check if the survey_name is already in the dictionary + survey_name = data['survey_name'] + if survey_name not in data_dict: + data_dict[ + survey_name] = [] + data_dict[survey_name].append(data) + grouped_data_list = [ + {'survey_name': survey_name, 'partner_id': self.partner_id.name, + 'data': survey_data} for survey_name, survey_data in + data_dict.items()] + dict_data = { + 'record': grouped_data_list + } + return { + 'type': 'ir.actions.report', + 'data': { + 'model': 'survey.xlsx.report', + 'options': json.dumps(dict_data, + default=json_default), + 'output_format': 'xlsx', + 'report_name': 'Survey Question Answer Report', + }, + 'report_type': 'xlsx', + } + + def get_xlsx_report(self, dict_data, response): + """ + Generates an XLSX report from the provided data and writes it to + the response. + + This method is responsible for creating an Excel report using the + `xlsxwriter` library. It processes the survey data contained in + `dict_data` and formats it into a structured XLSX report. The report + includes details such as survey name, respondent name, response + date, questions, and answers. + + Parameters: + dict_data (dict): A dictionary containing the survey data to be + included in the report. The dictionary should have a key 'record' + which holds a list of survey response data. response (werkzeug. + wrappers.Response): The HTTP response object where the generated + XLSX file will be written. + + The report's layout adjusts based on whether a specific partner is + associated with the survey responses. If a partner is selected, the + report will include the partner's name; otherwise, it will show + general response data. + + The method does the following: + - Creates an in-memory XLSX file. + - Adds survey data to the worksheet. + - Applies formatting to the headers and cells. + - Writes the final XLSX file to the response stream. + + Returns: + None: The function directly writes the XLSX report to the response object. + """ + output = io.BytesIO() + workbook = xlsxwriter.Workbook(output, {'in_memory': True}) + sheet = workbook.add_worksheet() + format21 = workbook.add_format({'font_size': 10, 'bold': True}) + font_size_8 = workbook.add_format({'font_size': 8}) + head = workbook.add_format( + {'align': 'center', 'bold': True, 'font_size': '20px'}) + heading_row_height = 30 + if dict_data.get('record'): + if dict_data['record']: + row = 0 + for records in dict_data.get('record'): + sheet.write(row, 0, records['survey_name'], head) + sheet.set_row(sheet.dim_rowmax, heading_row_height) + sheet.merge_range(sheet.dim_rowmax, 0, sheet.dim_rowmax, 4, + records['survey_name'], + head) + row += 1 + if not records.get('partner_id'): + sheet.set_column('A:A', 5) + sheet.set_column('B:B', 15) + sheet.set_column('C:C', 15) + sheet.set_column('D:D', 76) + sheet.set_column('E:E', 56) + sheet.write(row, 0, 'Sl no', format21) + sheet.write(row, 1, 'Name', format21) + sheet.write(row, 2, 'Date', format21) + sheet.write(row, 3, 'Question', format21) + sheet.write(row, 4, 'Answer', format21) + row += 1 + a = 1 + for datas in records.get('data'): + sheet.write(row, 0, a, font_size_8) + a = a + 1 + sheet.write(row, 1, datas.get('user_name'), + font_size_8) + sheet.write(row, 2, datas.get('create_date'), + font_size_8) + sheet.write(row, 3, datas.get('question'), + font_size_8) + sheet.write(row, 4, datas.get('answer'), + font_size_8) + row += 1 + else: + sheet.set_column('A:A', 5) + sheet.set_column('B:B', 15) + sheet.set_column('C:C', 76) + sheet.set_column('D:D', 56) + sheet.write(row, 0, 'Sl no', format21) + sheet.write(row, 1, 'Date', format21) + sheet.write(row, 2, 'Question', format21) + sheet.write(row, 3, 'Answer', format21) + row += 1 + a = 1 + for datas in records.get('data'): + sheet.write(row, 0, a, font_size_8) + a = a + 1 + sheet.write(row, 1, datas.get('create_date'), + font_size_8) + sheet.write(row, 2, datas.get('question'), + font_size_8) + sheet.write(row, 3, datas.get('answer'), + font_size_8) + row += 1 + workbook.close() + output.seek(0) + response.stream.write(output.read()) + output.close() diff --git a/survey_export_xlsx/wizard/survey_xlsx_report_views.xml b/survey_export_xlsx/wizard/survey_xlsx_report_views.xml new file mode 100644 index 000000000..ee3e40143 --- /dev/null +++ b/survey_export_xlsx/wizard/survey_xlsx_report_views.xml @@ -0,0 +1,38 @@ + + + + + survey.xlsx.report.view.form + survey.xlsx.report + +
+ + + + + + + +
+
+
+