diff --git a/survey_upload_file/README.rst b/survey_upload_file/README.rst new file mode 100644 index 000000000..cb1ec3beb --- /dev/null +++ b/survey_upload_file/README.rst @@ -0,0 +1,42 @@ +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg + :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +File Upload In Survey +===================== +This module is used for attachment of files in Survey Form + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +General Public License, Version 3 (AGPL v3). +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Credits +------- +Developer: (V15) Mohammed Dilshad Tk @Cybrosys, 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_upload_file/__init__.py b/survey_upload_file/__init__.py new file mode 100644 index 000000000..4fada9f6b --- /dev/null +++ b/survey_upload_file/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Mohammed Dilshad Tk (odoo@cybrosys.com) +# +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################ +from . import models diff --git a/survey_upload_file/__manifest__.py b/survey_upload_file/__manifest__.py new file mode 100644 index 000000000..138e571e9 --- /dev/null +++ b/survey_upload_file/__manifest__.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Mohammed Dilshad Tk (odoo@cybrosys.com) +# +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################ +{ + 'name': "File Upload In Survey", + 'version': "15.0.1.0.0", + 'category': 'Extra Tools', + 'summary': 'Attachment of File in Survey Form', + 'description': 'This module is used for attachments of file in Survey Form,' + 'You can also add multiple file attachment to Survey Form .', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'depends': ['survey'], + 'assets': { + 'web.assets_frontend': [ + 'survey_upload_file/static/src/js/survey_form_attachment.js', + ], + }, + 'data': [ + 'views/survey_question_views.xml', + 'views/survey_user_views.xml', + 'views/survey_templates.xml', + ], + 'images': ['static/description/banner.jpg'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/survey_upload_file/doc/RELEASE_NOTES.md b/survey_upload_file/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..69609fe24 --- /dev/null +++ b/survey_upload_file/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 27.11.2024 +#### Version 15.0.1.0.0 +#### ADD + +- Initial Commit for File Upload In Survey diff --git a/survey_upload_file/models/__init__.py b/survey_upload_file/models/__init__.py new file mode 100644 index 000000000..223d810fe --- /dev/null +++ b/survey_upload_file/models/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Mohammed Dilshad Tk (odoo@cybrosys.com) +# +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################ +from . import survey_question +from . import survey_user_input_line +from . import survey_user_input diff --git a/survey_upload_file/models/survey_question.py b/survey_upload_file/models/survey_question.py new file mode 100644 index 000000000..8fd76716c --- /dev/null +++ b/survey_upload_file/models/survey_question.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Mohammed Dilshad Tk (odoo@cybrosys.com) +# +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################ +from odoo import fields, models + + +class SurveyQuestion(models.Model): + """ + This class extends the 'survey.question' model to add new functionality + for file uploads. + """ + _inherit = 'survey.question' + + question_type = fields.Selection( + selection_add=[('upload_file', 'Upload File')], + help='Select the type of question to create.') + upload_multiple_file = fields.Boolean(string='Upload Multiple File', + help='Check this box if you want to ' + 'allow users to upload ' + 'multiple files') diff --git a/survey_upload_file/models/survey_user_input.py b/survey_upload_file/models/survey_user_input.py new file mode 100644 index 000000000..d225622eb --- /dev/null +++ b/survey_upload_file/models/survey_user_input.py @@ -0,0 +1,83 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Mohammed Dilshad Tk (odoo@cybrosys.com) +# +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################ +from odoo import models + + +class SurveyUserInput(models.Model): + """ + This class extends the 'survey.user_input' model to add custom + functionality for saving user answers. + + Methods: + save_lines: Save the user's answer for the given question + _save_line_file:Save the user's file upload answer for the given + question + _get_line_answer_file_upload_values: + Get the values to use when creating or updating a user input line + for a file upload answer + """ + _inherit = "survey.user_input" + + def save_lines(self, question, answer, comment=None): + """Save the user's answer for the given question.""" + old_answers = self.env['survey.user_input.line'].search([ + ('user_input_id', '=', self.id), + ('question_id', '=', question.id), ]) + if question.question_type in 'upload_file': + res = self._save_line_file(question, old_answers, answer) + else: + res = super().save_lines(question, answer, comment) + return res + + def _save_line_file(self, question, old_answers, answer): + """ Save the user's file upload answer for the given question.""" + vals = self._get_line_answer_file_upload_values(question, + 'upload_file', answer) + if old_answers: + old_answers.write(vals) + return old_answers + else: + return self.env['survey.user_input.line'].create(vals) + + def _get_line_answer_file_upload_values(self, question, answer_type, + answer): + """Get the values to use when creating or updating a user input line + for a file upload answer.""" + vals = { + 'user_input_id': self.id, + 'question_id': question.id, + 'skipped': False, + 'answer_type': answer_type, + } + if answer_type == 'upload_file': + file_data = answer[0] + file_name = answer[1] + attachment_ids = [] + for file in range(len(answer[1])): + attachment = self.env['ir.attachment'].create({ + 'name': file_name[file], + 'type': 'binary', + 'datas': file_data[file], + }) + attachment_ids.append(attachment.id) + vals['value_file_data_ids'] = attachment_ids + return vals diff --git a/survey_upload_file/models/survey_user_input_line.py b/survey_upload_file/models/survey_user_input_line.py new file mode 100644 index 000000000..2b7d3e9fd --- /dev/null +++ b/survey_upload_file/models/survey_user_input_line.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Mohammed Dilshad Tk (odoo@cybrosys.com) +# +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################ +from odoo import api, fields, models + + +class SurveyUserInputLine(models.Model): + """ + This class extends the 'survey.user_input.line' model to add additional + fields and constraints for file uploads. + Methods: + _check_answer_type_skipped:Check that a line's answer type is + not set to 'upload_file' if the line is skipped + """ + _inherit = "survey.user_input.line" + + answer_type = fields.Selection( + selection_add=[('upload_file', 'Upload File')], + help="The type of answer for this question (upload_file if the user " + "is uploading a file).") + value_file_data_ids = fields.Many2many('ir.attachment', + help="The attachments " + "corresponding to the user's " + "file upload answer, if any.") + + @api.constrains('skipped', 'answer_type') + def _check_answer_type_skipped(self): + """ Check that a line's answer type is not set to 'upload_file' if + the line is skipped.""" + for line in self: + if line.answer_type != 'upload_file': + super(SurveyUserInputLine, line)._check_answer_type_skipped() diff --git a/survey_upload_file/static/description/assets/icons/check.png b/survey_upload_file/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/survey_upload_file/static/description/assets/icons/check.png differ diff --git a/survey_upload_file/static/description/assets/icons/chevron.png b/survey_upload_file/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/survey_upload_file/static/description/assets/icons/chevron.png differ diff --git a/survey_upload_file/static/description/assets/icons/cogs.png b/survey_upload_file/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/survey_upload_file/static/description/assets/icons/cogs.png differ diff --git a/survey_upload_file/static/description/assets/icons/consultation.png b/survey_upload_file/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/survey_upload_file/static/description/assets/icons/consultation.png differ diff --git a/survey_upload_file/static/description/assets/icons/ecom-black.png b/survey_upload_file/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/survey_upload_file/static/description/assets/icons/ecom-black.png differ diff --git a/survey_upload_file/static/description/assets/icons/education-black.png b/survey_upload_file/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/survey_upload_file/static/description/assets/icons/education-black.png differ diff --git a/survey_upload_file/static/description/assets/icons/hotel-black.png b/survey_upload_file/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/survey_upload_file/static/description/assets/icons/hotel-black.png differ diff --git a/survey_upload_file/static/description/assets/icons/license.png b/survey_upload_file/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/survey_upload_file/static/description/assets/icons/license.png differ diff --git a/survey_upload_file/static/description/assets/icons/lifebuoy.png b/survey_upload_file/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/survey_upload_file/static/description/assets/icons/lifebuoy.png differ diff --git a/survey_upload_file/static/description/assets/icons/manufacturing-black.png b/survey_upload_file/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/survey_upload_file/static/description/assets/icons/manufacturing-black.png differ diff --git a/survey_upload_file/static/description/assets/icons/pos-black.png b/survey_upload_file/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/survey_upload_file/static/description/assets/icons/pos-black.png differ diff --git a/survey_upload_file/static/description/assets/icons/puzzle.png b/survey_upload_file/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/survey_upload_file/static/description/assets/icons/puzzle.png differ diff --git a/survey_upload_file/static/description/assets/icons/restaurant-black.png b/survey_upload_file/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/survey_upload_file/static/description/assets/icons/restaurant-black.png differ diff --git a/survey_upload_file/static/description/assets/icons/service-black.png b/survey_upload_file/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/survey_upload_file/static/description/assets/icons/service-black.png differ diff --git a/survey_upload_file/static/description/assets/icons/trading-black.png b/survey_upload_file/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/survey_upload_file/static/description/assets/icons/trading-black.png differ diff --git a/survey_upload_file/static/description/assets/icons/training.png b/survey_upload_file/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/survey_upload_file/static/description/assets/icons/training.png differ diff --git a/survey_upload_file/static/description/assets/icons/update.png b/survey_upload_file/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/survey_upload_file/static/description/assets/icons/update.png differ diff --git a/survey_upload_file/static/description/assets/icons/user.png b/survey_upload_file/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/survey_upload_file/static/description/assets/icons/user.png differ diff --git a/survey_upload_file/static/description/assets/icons/wrench.png b/survey_upload_file/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/survey_upload_file/static/description/assets/icons/wrench.png differ diff --git a/survey_upload_file/static/description/assets/misc/categories.png b/survey_upload_file/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/survey_upload_file/static/description/assets/misc/categories.png differ diff --git a/survey_upload_file/static/description/assets/misc/check-box.png b/survey_upload_file/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/survey_upload_file/static/description/assets/misc/check-box.png differ diff --git a/survey_upload_file/static/description/assets/misc/compass.png b/survey_upload_file/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/survey_upload_file/static/description/assets/misc/compass.png differ diff --git a/survey_upload_file/static/description/assets/misc/corporate.png b/survey_upload_file/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/survey_upload_file/static/description/assets/misc/corporate.png differ diff --git a/survey_upload_file/static/description/assets/misc/customer-support.png b/survey_upload_file/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/survey_upload_file/static/description/assets/misc/customer-support.png differ diff --git a/survey_upload_file/static/description/assets/misc/cybrosys-logo.png b/survey_upload_file/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/survey_upload_file/static/description/assets/misc/cybrosys-logo.png differ diff --git a/survey_upload_file/static/description/assets/misc/features.png b/survey_upload_file/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/survey_upload_file/static/description/assets/misc/features.png differ diff --git a/survey_upload_file/static/description/assets/misc/logo.png b/survey_upload_file/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/survey_upload_file/static/description/assets/misc/logo.png differ diff --git a/survey_upload_file/static/description/assets/misc/pictures.png b/survey_upload_file/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/survey_upload_file/static/description/assets/misc/pictures.png differ diff --git a/survey_upload_file/static/description/assets/misc/pie-chart.png b/survey_upload_file/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/survey_upload_file/static/description/assets/misc/pie-chart.png differ diff --git a/survey_upload_file/static/description/assets/misc/right-arrow.png b/survey_upload_file/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/survey_upload_file/static/description/assets/misc/right-arrow.png differ diff --git a/survey_upload_file/static/description/assets/misc/star.png b/survey_upload_file/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/survey_upload_file/static/description/assets/misc/star.png differ diff --git a/survey_upload_file/static/description/assets/misc/support.png b/survey_upload_file/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/survey_upload_file/static/description/assets/misc/support.png differ diff --git a/survey_upload_file/static/description/assets/misc/whatsapp.png b/survey_upload_file/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/survey_upload_file/static/description/assets/misc/whatsapp.png differ diff --git a/survey_upload_file/static/description/assets/modules/i-1.gif b/survey_upload_file/static/description/assets/modules/i-1.gif new file mode 100644 index 000000000..b9fa8b25f Binary files /dev/null and b/survey_upload_file/static/description/assets/modules/i-1.gif differ diff --git a/survey_upload_file/static/description/assets/modules/i-2.png b/survey_upload_file/static/description/assets/modules/i-2.png new file mode 100644 index 000000000..ddddad153 Binary files /dev/null and b/survey_upload_file/static/description/assets/modules/i-2.png differ diff --git a/survey_upload_file/static/description/assets/modules/i-3.png b/survey_upload_file/static/description/assets/modules/i-3.png new file mode 100644 index 000000000..2c3fa39b1 Binary files /dev/null and b/survey_upload_file/static/description/assets/modules/i-3.png differ diff --git a/survey_upload_file/static/description/assets/modules/i-5.png b/survey_upload_file/static/description/assets/modules/i-5.png new file mode 100644 index 000000000..588310137 Binary files /dev/null and b/survey_upload_file/static/description/assets/modules/i-5.png differ diff --git a/survey_upload_file/static/description/assets/modules/i-6.png b/survey_upload_file/static/description/assets/modules/i-6.png new file mode 100644 index 000000000..993538ef8 Binary files /dev/null and b/survey_upload_file/static/description/assets/modules/i-6.png differ diff --git a/survey_upload_file/static/description/assets/modules/ii-4.png b/survey_upload_file/static/description/assets/modules/ii-4.png new file mode 100644 index 000000000..df91c481d Binary files /dev/null and b/survey_upload_file/static/description/assets/modules/ii-4.png differ diff --git a/survey_upload_file/static/description/assets/screenshots/1.png b/survey_upload_file/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..bd000044b Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/1.png differ diff --git a/survey_upload_file/static/description/assets/screenshots/10.png b/survey_upload_file/static/description/assets/screenshots/10.png new file mode 100644 index 000000000..650e7a929 Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/10.png differ diff --git a/survey_upload_file/static/description/assets/screenshots/11.png b/survey_upload_file/static/description/assets/screenshots/11.png new file mode 100644 index 000000000..a30c1409a Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/11.png differ diff --git a/survey_upload_file/static/description/assets/screenshots/12.png b/survey_upload_file/static/description/assets/screenshots/12.png new file mode 100644 index 000000000..1355d77ab Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/12.png differ diff --git a/survey_upload_file/static/description/assets/screenshots/13.png b/survey_upload_file/static/description/assets/screenshots/13.png new file mode 100644 index 000000000..beec0350c Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/13.png differ diff --git a/survey_upload_file/static/description/assets/screenshots/14.png b/survey_upload_file/static/description/assets/screenshots/14.png new file mode 100644 index 000000000..68b8396d9 Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/14.png differ diff --git a/survey_upload_file/static/description/assets/screenshots/15.png b/survey_upload_file/static/description/assets/screenshots/15.png new file mode 100644 index 000000000..331210147 Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/15.png differ diff --git a/survey_upload_file/static/description/assets/screenshots/16.png b/survey_upload_file/static/description/assets/screenshots/16.png new file mode 100644 index 000000000..980da2f50 Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/16.png differ diff --git a/survey_upload_file/static/description/assets/screenshots/2.png b/survey_upload_file/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..4e0778240 Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/2.png differ diff --git a/survey_upload_file/static/description/assets/screenshots/3.png b/survey_upload_file/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..bf862647f Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/3.png differ diff --git a/survey_upload_file/static/description/assets/screenshots/4.png b/survey_upload_file/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..a32e7b5ae Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/4.png differ diff --git a/survey_upload_file/static/description/assets/screenshots/5.png b/survey_upload_file/static/description/assets/screenshots/5.png new file mode 100644 index 000000000..b8d74a405 Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/5.png differ diff --git a/survey_upload_file/static/description/assets/screenshots/6.png b/survey_upload_file/static/description/assets/screenshots/6.png new file mode 100644 index 000000000..d3f220f21 Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/6.png differ diff --git a/survey_upload_file/static/description/assets/screenshots/7.png b/survey_upload_file/static/description/assets/screenshots/7.png new file mode 100644 index 000000000..4a242d96e Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/7.png differ diff --git a/survey_upload_file/static/description/assets/screenshots/8.png b/survey_upload_file/static/description/assets/screenshots/8.png new file mode 100644 index 000000000..776705dc4 Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/8.png differ diff --git a/survey_upload_file/static/description/assets/screenshots/9.png b/survey_upload_file/static/description/assets/screenshots/9.png new file mode 100644 index 000000000..63abd7299 Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/9.png differ diff --git a/survey_upload_file/static/description/assets/screenshots/hero.gif b/survey_upload_file/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..190fd22c6 Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/hero.gif differ diff --git a/survey_upload_file/static/description/banner.jpg b/survey_upload_file/static/description/banner.jpg new file mode 100644 index 000000000..09b97b491 Binary files /dev/null and b/survey_upload_file/static/description/banner.jpg differ diff --git a/survey_upload_file/static/description/icon.png b/survey_upload_file/static/description/icon.png new file mode 100644 index 000000000..c823977fa Binary files /dev/null and b/survey_upload_file/static/description/icon.png differ diff --git a/survey_upload_file/static/description/index.html b/survey_upload_file/static/description/index.html new file mode 100644 index 000000000..14400dead --- /dev/null +++ b/survey_upload_file/static/description/index.html @@ -0,0 +1,592 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+ +
+ Odoo.sh +
+
+
+ +
+
+
+ +

+ File Upload In Survey +

+

File Upload In Survey Adds Single Or Multiple File Upload Options In Survey. +

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

Explore This Module

+
+ + + + +
+
+ +
+

Overview +

+
+
+
+ File Upload In Survey Odoo app adds single or multiple file upload options to surveys. Users can add questions to the survey that allow participants to upload files as answers. Participants can either choose to upload a single file or add multiple files in response to the survey question. Participants can view their uploaded attachments by clicking the "review your answers" button in the survey.
+
+ + +
+
+ +
+

Features +

+
+
+
+
+ + User can upload file for survey questions. +
+
+ + Upload single file as answer for survey questions or Upload multiple file as answer for survey questions. + +
+
+ +
+ + Participants can view their answer in the 'review your answers' button in Survey form. + +
+
+
+
+ + +
+
+ +
+

Screenshots +

+
+

Single Attachment Download

+
+
+
+

On survey, user can add questions as file upload type and allow user to add file as attachment answer. +

+ +
+
+

User can select "Upload File" as "Question Type", User can also see question type view icon for file upload. +

+ +
+
+

On survey participants + can see "Browse/Choose File" options for "File Upload" question type, by clicking this button user can upload a file as + attachment and also a note is shown so the Participant can know he can only upload one File. +

+ +
+ +
+

+ Once participants finish survey he/she can view attached file by clicking "review your answers" button. +

+ +
+
+

+ The Participant can view and download the attachments by clicking the File Name. +

+ +
+
+

+ User can see uploaded files on by clicking the smart button inside question form. +

+ +
+

+ Remove this filter to view uploaded answers

+
+ +
+ +
+ +
+
+

+ The User can download the Attachment of the Participant From Here. +

+ +
+
+ +
+

Multiple Attachments Download

+
+

+ On survey, user can add questions as file upload type and allow survey participants to add multiple file as attachment answer. +

+ +
+ +
+

+ User can select "File Upload" as "Question Type", User also need to enable " Upload Multiple file" options only then survey participants can also see question type view icon for file upload.

+ +
+
+

+ On survey participants can see "Browse/Choose File" options for "File Upload" question type, by + clicking this + button user can select and upload multiple files as attachment and also a note is shown so the Participant can know he can upload multiple Files. +

+ +
+ + +
+

+ Once participants finish survey he/she can view all uploaded multiple file by clicking "review your answers" button and also download and view attachments by clicking file. +

+ +

+ The Participant can view and download the attachments by clicking the File Name. +

+ +
+ +
+

+ User can see uploaded files on answers. +

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

Related + Products +

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

Our Services +

+
+ +
+
+
+
+ +
+
+ Odoo Customization
+
+ +
+
+ +
+
+ Odoo Implementation
+
+ +
+
+ +
+
+ Odoo Support
+
+ +
+
+ +
+
+ Hire Odoo Developer
+
+ +
+
+ +
+
+ Odoo + Integration
+
+ +
+
+ +
+
+ Odoo + Migration
+
+ +
+
+ +
+
+ Odoo + Consultancy
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Licensing Consultancy
+
+
+
+ + + +
+
+ +
+

Our + Industries +

+
+ +
+
+
+
+ +
+ Trading +
+

+ Easily procure + and + sell your products

+
+
+ +
+
+ +
+ POS +
+

+ Easy + configuration + and convivial experience

+
+
+ +
+
+ +
+ Education +
+

+ A platform for + educational management

+
+
+ +
+
+ +
+ Manufacturing +
+

+ Plan, track and + schedule your operations

+
+
+ +
+
+ +
+ E-commerce & Website +
+

+ Mobile + friendly, + awe-inspiring product pages

+
+
+ +
+
+ +
+ Service Management +
+

+ Keep track of + services and invoice

+
+
+ +
+
+ +
+ Restaurant +
+

+ Run your bar or + restaurant methodically

+
+
+ +
+
+ +
+ Hotel Management +
+

+ An + all-inclusive + hotel management application

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

Support +

+
+
+
+
+
+
+ +
+
+

Need Help?

+

Got questions or need help? Get in touch.

+ +

+ odoo@cybrosys.com

+
+
+
+
+
+
+
+ +
+
+

WhatsApp

+

Say hi to us on WhatsApp!

+ +

+91 86068 + 27707

+
+
+
+
+
+
+
+ +
+
+
+ \ No newline at end of file diff --git a/survey_upload_file/static/src/js/survey_form_attachment.js b/survey_upload_file/static/src/js/survey_form_attachment.js new file mode 100644 index 000000000..214e2a849 --- /dev/null +++ b/survey_upload_file/static/src/js/survey_form_attachment.js @@ -0,0 +1,116 @@ +odoo.define('survey_upload_file', function (require) { + 'use strict'; + + var SurveyFormWidget = require('survey.form'); + var core = require('web.core'); + + SurveyFormWidget.include({ + events: _.extend({}, SurveyFormWidget.prototype.events, { + 'change .o_survey_upload_file': '_onFileChange', + }), + // On adding file function + _onFileChange: function (event) { + var self = this; + var files = event.target.files; + var fileNames = []; + var dataURLs = []; + + // Loop through the selected files + for (let i = 0; i < files.length; i++) { + var reader = new FileReader(); + reader.readAsDataURL(files[i]); + + reader.onload = function (e) { + var file = files[i]; + var filename = file.name; + var dataURL = e.target.result.split(',')[1]; // split base64 data + + fileNames.push(filename); + dataURLs.push(dataURL); + + // Set the attributes for the input element + var $input = $(event.target); + $input.attr('data-oe-data', JSON.stringify(dataURLs)); + $input.attr('data-oe-file_name', JSON.stringify(fileNames)); + + // Find the corresponding fileList div based on the question ID (matching data attribute) + var $fileListContainer = $(event.target) + .closest('.o_survey_upload_container') + .find('#fileList'); + + var questionId = $fileListContainer.attr('data'); + + // Check if the fileList div corresponds to the input clicked (based on question ID) + if ($fileListContainer.attr('data') == event.target.name) { + // Clear previous contents of the file list + $fileListContainer.html(''); + + // Create a new list of files + var ul = document.createElement('ul'); + fileNames.forEach(function (fileName) { + var li = document.createElement('li'); + li.textContent = fileName; + ul.appendChild(li); + }); + + // Create a delete button + var deleteBtn = document.createElement('button'); + deleteBtn.textContent = 'Delete All'; + deleteBtn.addEventListener('click', function () { + // Clear file list and reset input attributes + $fileListContainer.html(''); + $input.attr('data-oe-data', ''); + $input.attr('data-oe-file_name', ''); + $input.val(''); // Clear the file input + }); + + // Append the file list and delete button to the fileList div + $fileListContainer.append(ul); + $fileListContainer.append(deleteBtn); + } + }; + } + }, + // Get all question answers by question type + _prepareSubmitValues: function (formData, params) { + this._super(formData, params); + this.$('[data-question-type]').each(function () { + if ($(this).data('questionType') === 'upload_file') { + params[this.name] = [ + $(this).data('oe-data'), + $(this).data('oe-file_name'), + ]; + } + }); + }, + // Add file upload required case + _validateForm: function ($form, formData) { + this._super($form, formData); + var errors = {}; + $form.find('[data-question-type]').each(function () { + var $input = $(this); + var $questionWrapper = $input.closest('.js_question-wrapper'); + var questionRequired = $questionWrapper.data('required'); + var constrErrorMsg = $questionWrapper.data('constrErrorMsg'); + var validationErrorMsg = $questionWrapper.data('validationErrorMsg'); + var questionId = $questionWrapper.attr('id'); + + switch ($input.data('questionType')) { + case 'upload_file': + if (questionRequired && !$input.val()) { + errors[questionId] = constrErrorMsg; + } + break; + } + }); + + if (_.keys(errors).length > 0) { + this._showErrors(errors); + return false; + } + + return true; + }, + }); +}); + \ No newline at end of file diff --git a/survey_upload_file/views/survey_question_views.xml b/survey_upload_file/views/survey_question_views.xml new file mode 100644 index 000000000..f1f294b17 --- /dev/null +++ b/survey_upload_file/views/survey_question_views.xml @@ -0,0 +1,23 @@ + + + + + survey.question.view.form.inherit.survey.upload.file + survey.question + + + +
+

Upload Files + +

+
+
+ + + +
+
+
diff --git a/survey_upload_file/views/survey_templates.xml b/survey_upload_file/views/survey_templates.xml new file mode 100644 index 000000000..5d3767f46 --- /dev/null +++ b/survey_upload_file/views/survey_templates.xml @@ -0,0 +1,63 @@ + + + + + + + + + + diff --git a/survey_upload_file/views/survey_user_views.xml b/survey_upload_file/views/survey_user_views.xml new file mode 100644 index 000000000..be764c5b7 --- /dev/null +++ b/survey_upload_file/views/survey_user_views.xml @@ -0,0 +1,20 @@ + + + + + survey.user_input.line.view.form.inherit.survey.upload.file + survey.user_input.line + + + + + + + + + + + + + +