diff --git a/survey_upload_file/README.rst b/survey_upload_file/README.rst new file mode 100644 index 000000000..263e45c52 --- /dev/null +++ b/survey_upload_file/README.rst @@ -0,0 +1,42 @@ +.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg + :target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 + +File Upload In Survey +===================== +This module is used for attachment of files in Survey Form + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +General Public License v3.0 (LGPL v3) +(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) + +Credits +------- +Developer: (V17) 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..f6e5198f5 --- /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) +# +# 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 models diff --git a/survey_upload_file/__manifest__.py b/survey_upload_file/__manifest__.py new file mode 100644 index 000000000..670288563 --- /dev/null +++ b/survey_upload_file/__manifest__.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) +# +# 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': "File Upload In Survey", + 'version': "17.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': { + 'survey.survey_assets': [ + 'survey_upload_file/static/src/js/survey_form_attachment.js', + 'survey_upload_file/static/src/js/SurveyFormWidget.js', + ], + }, + 'data': [ + 'views/survey_question_views.xml', + 'views/survey_user_views.xml', + 'views/survey_templates.xml', + ], + 'images': ['static/description/banner.jpg'], + 'license': 'LGPL-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..578f5bdd6 --- /dev/null +++ b/survey_upload_file/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 07.06.2024 +#### Version 16.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..d43011b01 --- /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) +# +# 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_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..1f2946221 --- /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) +# +# 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 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..26ae5a1af --- /dev/null +++ b/survey_upload_file/models/survey_user_input.py @@ -0,0 +1,85 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Mohammed Dilshad Tk (odoo@cybrosys.com) +# +# 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 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, + overwrite_existing=False): + """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_simple_answer(question, old_answers, answer) + else: + res = super()._save_lines(question, answer, comment, + overwrite_existing) + return res + + def _save_line_simple_answer(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..3868803ad --- /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) +# +# 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 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/capture (1).png b/survey_upload_file/static/description/assets/icons/capture (1).png new file mode 100644 index 000000000..8824deafc Binary files /dev/null and b/survey_upload_file/static/description/assets/icons/capture (1).png differ 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/img.png b/survey_upload_file/static/description/assets/icons/img.png new file mode 100644 index 000000000..70197f477 Binary files /dev/null and b/survey_upload_file/static/description/assets/icons/img.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/photo-capture.png b/survey_upload_file/static/description/assets/icons/photo-capture.png new file mode 100644 index 000000000..06c111758 Binary files /dev/null and b/survey_upload_file/static/description/assets/icons/photo-capture.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/Cybrosys R.png b/survey_upload_file/static/description/assets/misc/Cybrosys R.png new file mode 100644 index 000000000..da4058087 Binary files /dev/null and b/survey_upload_file/static/description/assets/misc/Cybrosys R.png differ diff --git a/survey_upload_file/static/description/assets/misc/email.svg b/survey_upload_file/static/description/assets/misc/email.svg new file mode 100644 index 000000000..15291cdc3 --- /dev/null +++ b/survey_upload_file/static/description/assets/misc/email.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/survey_upload_file/static/description/assets/misc/phone.svg b/survey_upload_file/static/description/assets/misc/phone.svg new file mode 100644 index 000000000..b7bd7f251 --- /dev/null +++ b/survey_upload_file/static/description/assets/misc/phone.svg @@ -0,0 +1,3 @@ + + + diff --git a/survey_upload_file/static/description/assets/misc/star (1) 2.svg b/survey_upload_file/static/description/assets/misc/star (1) 2.svg new file mode 100644 index 000000000..5ae9f507a --- /dev/null +++ b/survey_upload_file/static/description/assets/misc/star (1) 2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/survey_upload_file/static/description/assets/misc/support (1) 1.svg b/survey_upload_file/static/description/assets/misc/support (1) 1.svg new file mode 100644 index 000000000..7d37a8f30 --- /dev/null +++ b/survey_upload_file/static/description/assets/misc/support (1) 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/survey_upload_file/static/description/assets/misc/support-email.svg b/survey_upload_file/static/description/assets/misc/support-email.svg new file mode 100644 index 000000000..eb70370d6 --- /dev/null +++ b/survey_upload_file/static/description/assets/misc/support-email.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/survey_upload_file/static/description/assets/misc/tick-mark.svg b/survey_upload_file/static/description/assets/misc/tick-mark.svg new file mode 100644 index 000000000..2dbb40187 --- /dev/null +++ b/survey_upload_file/static/description/assets/misc/tick-mark.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/survey_upload_file/static/description/assets/misc/whatsapp 1.svg b/survey_upload_file/static/description/assets/misc/whatsapp 1.svg new file mode 100644 index 000000000..0bfaf8fc6 --- /dev/null +++ b/survey_upload_file/static/description/assets/misc/whatsapp 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/survey_upload_file/static/description/assets/misc/whatsapp.svg b/survey_upload_file/static/description/assets/misc/whatsapp.svg new file mode 100644 index 000000000..b618aea1d --- /dev/null +++ b/survey_upload_file/static/description/assets/misc/whatsapp.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/survey_upload_file/static/description/assets/modules/1.jpg b/survey_upload_file/static/description/assets/modules/1.jpg new file mode 100644 index 000000000..08bbafeb6 Binary files /dev/null and b/survey_upload_file/static/description/assets/modules/1.jpg differ diff --git a/survey_upload_file/static/description/assets/modules/2.png b/survey_upload_file/static/description/assets/modules/2.png new file mode 100644 index 000000000..66730082c Binary files /dev/null and b/survey_upload_file/static/description/assets/modules/2.png differ diff --git a/survey_upload_file/static/description/assets/modules/3.jpg b/survey_upload_file/static/description/assets/modules/3.jpg new file mode 100644 index 000000000..3d171226b Binary files /dev/null and b/survey_upload_file/static/description/assets/modules/3.jpg differ diff --git a/survey_upload_file/static/description/assets/modules/4.jpg b/survey_upload_file/static/description/assets/modules/4.jpg new file mode 100644 index 000000000..1f3f2e27f Binary files /dev/null and b/survey_upload_file/static/description/assets/modules/4.jpg differ diff --git a/survey_upload_file/static/description/assets/modules/5.jpg b/survey_upload_file/static/description/assets/modules/5.jpg new file mode 100644 index 000000000..0db717519 Binary files /dev/null and b/survey_upload_file/static/description/assets/modules/5.jpg differ diff --git a/survey_upload_file/static/description/assets/modules/6.jpg b/survey_upload_file/static/description/assets/modules/6.jpg new file mode 100644 index 000000000..cd62a577c Binary files /dev/null and b/survey_upload_file/static/description/assets/modules/6.jpg differ diff --git a/survey_upload_file/static/description/assets/screenshots/011.png b/survey_upload_file/static/description/assets/screenshots/011.png new file mode 100644 index 000000000..75ba37f1a Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/011.png differ diff --git a/survey_upload_file/static/description/assets/screenshots/012.png b/survey_upload_file/static/description/assets/screenshots/012.png new file mode 100644 index 000000000..1926a4976 Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/012.png differ diff --git a/survey_upload_file/static/description/assets/screenshots/013.png b/survey_upload_file/static/description/assets/screenshots/013.png new file mode 100644 index 000000000..74ae201e7 Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/013.png differ diff --git a/survey_upload_file/static/description/assets/screenshots/014.png b/survey_upload_file/static/description/assets/screenshots/014.png new file mode 100644 index 000000000..d2eec8f2e Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/014.png differ diff --git a/survey_upload_file/static/description/assets/screenshots/015.png b/survey_upload_file/static/description/assets/screenshots/015.png new file mode 100644 index 000000000..04b6cd9ea Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/015.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..001e0dd35 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..10098a324 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/22.png b/survey_upload_file/static/description/assets/screenshots/22.png new file mode 100644 index 000000000..1f31e389d Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/22.png differ diff --git a/survey_upload_file/static/description/assets/screenshots/33.png b/survey_upload_file/static/description/assets/screenshots/33.png new file mode 100644 index 000000000..744349211 Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/33.png differ diff --git a/survey_upload_file/static/description/assets/screenshots/44.png b/survey_upload_file/static/description/assets/screenshots/44.png new file mode 100644 index 000000000..d763b9b13 Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/44.png differ diff --git a/survey_upload_file/static/description/assets/screenshots/55.png b/survey_upload_file/static/description/assets/screenshots/55.png new file mode 100644 index 000000000..4e4760e65 Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/55.png differ diff --git a/survey_upload_file/static/description/assets/screenshots/66.png b/survey_upload_file/static/description/assets/screenshots/66.png new file mode 100644 index 000000000..1fbb88f94 Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/66.png differ diff --git a/survey_upload_file/static/description/assets/screenshots/77.png b/survey_upload_file/static/description/assets/screenshots/77.png new file mode 100644 index 000000000..1fe5bb49b Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/77.png differ diff --git a/survey_upload_file/static/description/assets/screenshots/88.png b/survey_upload_file/static/description/assets/screenshots/88.png new file mode 100644 index 000000000..e0a15ed1b Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/88.png differ diff --git a/survey_upload_file/static/description/assets/screenshots/99.png b/survey_upload_file/static/description/assets/screenshots/99.png new file mode 100644 index 000000000..478daf3f7 Binary files /dev/null and b/survey_upload_file/static/description/assets/screenshots/99.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..bd1492674 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..868a13062 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..9a41d34c5 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 100755 index 000000000..5476d6ecb --- /dev/null +++ b/survey_upload_file/static/description/index.html @@ -0,0 +1,882 @@ + + + + + + + File Upload In Survey + + + + + + + + +
+
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+
+
+
+

File Upload In Survey

+

Adds Single Or + Multiple File Upload Options In Survey.

+
+ +
+
+
+
+
+

+ Key Highlights +

+
+
+
+
+
+ +
+
+

User can upload file for survey + questions.

+
+
+
+
+
+
+ +
+
+

Upload single file as answer for survey + questions. +

+
+
+
+
+
+
+ +
+
+

Participants can view their answer in the + 'review your answers' button in Survey form.

+
+
+
+
+
+
+ +
+
+

Upload multiple file as answer for survey questions.

+
+
+
+
+
+
+ +
+
+
+

+
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 "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.

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

+ The User can Download the Attachment of the Participant 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 "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.

+
+
+ +
+
+
+
+
+
+
+
    +
  • + E-mail Notification +
  • +
  • + Detailed Account Details +
  • +
  • + System + Information in Notification Email +
  • + +
+
+
+
+
+
+
Version + 17.0.1.0.0|Released on:31 th May 2024 +
+

+ Initial Commit for File Upload In Survey

+
+
+
+
+
+
+

+ Related Products

+
+
+ +
+
+

+ Our Services

+ +
+
+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Customization

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Implementation

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Support

+
+
+
+
+
+
+ service-icon +
+
+

Hire + Odoo Developer

+
+
+
+
+ +
+
+ service-icon +
+
+

Odoo + Integration

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Migration

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Consultancy

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Implementation

+
+
+
+
+
+
+ service-icon +
+
+

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 + 99456767686 +
+
+
+
+
+
+
+
+
+ + + + + + diff --git a/survey_upload_file/static/src/js/SurveyFormWidget.js b/survey_upload_file/static/src/js/SurveyFormWidget.js new file mode 100644 index 000000000..e4c8e7d32 --- /dev/null +++ b/survey_upload_file/static/src/js/SurveyFormWidget.js @@ -0,0 +1,13 @@ +/** @odoo-module */ +import SurveyFormWidget from '@survey/js/survey_form'; +SurveyFormWidget.include({ + /** Get all question answers by question type */ + _prepareSubmitValues(formData, params) { + this._super(...arguments); + this.$('[data-question-type]').each(function () { + if ($(this).data('questionType') === 'upload_file'){ + params[this.name] = [$(this).data('oe-data'), $(this).data('oe-file_name')]; + } + }); + }, +}); 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..cf6450d27 --- /dev/null +++ b/survey_upload_file/static/src/js/survey_form_attachment.js @@ -0,0 +1,61 @@ +/** @odoo-module */ +import publicWidget from "@web/legacy/js/public/public_widget"; +import SurveyFormWidget from '@survey/js/survey_form'; +import SurveyPreloadImageMixin from "@survey/js/survey_preload_image_mixin"; +/** Extends publicWidget to create "SurveyFormUpload" */ +publicWidget.registry.SurveyFormUpload = publicWidget.Widget.extend(SurveyPreloadImageMixin, { + selector: '.o_survey_form', + events: { + 'change .o_survey_upload_file': '_onFileChange', + }, + init() { + this._super(...arguments); + this.rpc = this.bindService("rpc"); + }, + /** On adding file function */ + _onFileChange: function(event) { + var self = this; + var files = event.target.files; + var fileNames = []; + var dataURLs = []; + 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 data-oe-data and data-oe-file_name attributes of the input element self call el */ + var $input = self.$el.find('input.o_survey_upload_file'); + $input.attr('data-oe-data', JSON.stringify(dataURLs)); + $input.attr('data-oe-file_name', JSON.stringify(fileNames)); + // Create file list elements + var fileList = document.getElementById('fileList'); + fileList.innerHTML = ''; // clear previous contents of file list + var ul = document.createElement('ul'); + fileNames.forEach(function(fileName) { + var li = document.createElement('li'); + li.textContent = fileName; + ul.appendChild(li); + }); + // Create delete button + var deleteBtn = document.createElement('button'); + deleteBtn.textContent = 'Delete All'; + deleteBtn.addEventListener('click', function() { + // Clear file list + fileList.innerHTML = ''; + // Clear input field attributes + $input.attr('data-oe-data', ''); + $input.attr('data-oe-file_name', ''); + self.$el.find('input[type="file"]').val(''); + }); + // Append file list and delete button to file input container + fileList.appendChild(ul); + fileList.appendChild(deleteBtn); + } + } + }, + }); +export default publicWidget.registry.SurveyFormUpload; 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..39e9672e7 --- /dev/null +++ b/survey_upload_file/views/survey_question_views.xml @@ -0,0 +1,22 @@ + + + + + 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..8ffaaf51c --- /dev/null +++ b/survey_upload_file/views/survey_templates.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + 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..bf838178a --- /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 + + + + + + + + + + + + + +