diff --git a/survey_attachment/__init__.py b/survey_attachment/__init__.py index 91c5580..0650744 100644 --- a/survey_attachment/__init__.py +++ b/survey_attachment/__init__.py @@ -1,2 +1 @@ -from . import controllers from . import models diff --git a/survey_attachment/__manifest__.py b/survey_attachment/__manifest__.py index 4be772e..2a89c84 100644 --- a/survey_attachment/__manifest__.py +++ b/survey_attachment/__manifest__.py @@ -7,8 +7,8 @@ This module provides a new type of question in surveys, that allows to join a file as answer. """, 'description': """ """, - 'author': 'Fogits Solutions', - 'website': 'https://www.fogits.com/', + 'author': 'Sudokeys', + 'website': 'http://www.sudokeys.com/', 'license': 'AGPL-3', 'category': 'Marketing', 'depends': [ @@ -28,7 +28,7 @@ 'images': ['static/description/survey.jpg'], 'js': [], 'installable': True, - 'maintainer': 'Fogits Solutions, Sudokeys', + 'maintainer': 'Sudokeys', 'pre_init_hook': '', 'post_init_hook': '', 'uninstall_hook': '', diff --git a/survey_attachment/controllers/__init__.py b/survey_attachment/controllers/__init__.py deleted file mode 100644 index cd4d6a8..0000000 --- a/survey_attachment/controllers/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# -*- coding: utf-8 -*- -from . import main \ No newline at end of file diff --git a/survey_attachment/controllers/main.py b/survey_attachment/controllers/main.py deleted file mode 100644 index 064ce8a..0000000 --- a/survey_attachment/controllers/main.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- -from odoo import fields, http, SUPERUSER_ID -from odoo.http import request -from odoo.addons.survey.controllers.main import Survey -import logging - -_logger = logging.getLogger(__name__) - - -class SurveyAttachment(Survey): - # Printing routes - @http.route(['/survey/print/', - '/survey/print//'], - type='http', auth='public', website=True) - def print_survey(self, survey, token=None, **post): - '''Display an survey in printable view; if is set, it will - grab the answers of the user_input_id that has .''' - - survey_question = request.env['survey.question'] - user_input = request.env['survey.user_input'] - user_input_line = request.env['survey.user_input_line'] - - question_ids = survey_question.sudo().search([('type', '=', 'upload_file'), ('survey_id', '=', survey.id)]) - user_input_id = user_input.sudo().search([('token', '=', token), ('survey_id', '=', survey.id)]) - - user_input_line_upload_file = [] - for question in question_ids: - user_input_line = user_input_line.search([ - ('user_input_id', '=', user_input_id.id), - ('survey_id', '=', survey.id), - ('question_id', '=', question.id), - ('answer_type', '=', 'upload_file') - ]) - user_input_line_upload_file.append(user_input_line) - return request.render('survey.survey_print', - {'survey': survey, - 'token': token, - 'page_nr': 0, - 'quizz_correction': True if survey.quizz_mode and token else False, - 'user_input_line_upload_file': user_input_line_upload_file}) diff --git a/survey_attachment/i18n/fr.po b/survey_attachment/i18n/fr.po index 8438cfb..e47a5fc 100644 --- a/survey_attachment/i18n/fr.po +++ b/survey_attachment/i18n/fr.po @@ -26,7 +26,7 @@ msgstr "Type de réponse" #: selection:survey.user_input_line,answer_type:0 #, python-format msgid "Attachment" -msgstr " jointe" +msgstr "Pièce jointe" #. module: survey_attachment #: code:addons/survey_attachment/models/survey_question.py:8 diff --git a/survey_attachment/models/survey_question.py b/survey_attachment/models/survey_question.py index 72e38de..9c16b41 100644 --- a/survey_attachment/models/survey_question.py +++ b/survey_attachment/models/survey_question.py @@ -16,5 +16,5 @@ TYPES = [ class SurveyQuestion(models.Model): _inherit = 'survey.question' - question_attachment = fields.Binary(string="Joined attachment") + # question_attachment = fields.Binary(string="Joined attachment") type = fields.Selection(selection=TYPES) diff --git a/survey_attachment/models/survey_user_input_line.py b/survey_attachment/models/survey_user_input_line.py index 5068203..2b44adc 100644 --- a/survey_attachment/models/survey_user_input_line.py +++ b/survey_attachment/models/survey_user_input_line.py @@ -1,7 +1,15 @@ # -*- coding: utf-8 -*- import base64 from odoo import models, fields, api, _ -from .survey_question import TYPES + +ANSWER_TYPES = [ + ('text', _('Text')), + ('number', _('Number')), + ('date', _('Date')), + ('free_text', _('Free Text')), + ('upload_file', _('Attachment')), + ('suggestion', _('Suggestion')), +] FILE_TYPES = [ ('image', _('Image')), @@ -12,7 +20,7 @@ FILE_TYPES = [ class SurveyUserInputLine(models.Model): _inherit = 'survey.user_input_line' - answer_type = fields.Selection(selection=TYPES) + answer_type = fields.Selection(selection=ANSWER_TYPES) file = fields.Binary(string='Uploaded file') filename = fields.Char(string='Uploaded file name') file_type = fields.Selection(selection=FILE_TYPES, string="File type") diff --git a/survey_attachment/static/description/icon.png b/survey_attachment/static/description/icon.png deleted file mode 100644 index a7086ee..0000000 Binary files a/survey_attachment/static/description/icon.png and /dev/null differ diff --git a/survey_attachment/static/description/image_2.png b/survey_attachment/static/description/image_2.png deleted file mode 100644 index 7cd2e04..0000000 Binary files a/survey_attachment/static/description/image_2.png and /dev/null differ diff --git a/survey_attachment/static/description/imge_1.png b/survey_attachment/static/description/imge_1.png deleted file mode 100644 index 60923d8..0000000 Binary files a/survey_attachment/static/description/imge_1.png and /dev/null differ diff --git a/survey_attachment/static/description/index.html b/survey_attachment/static/description/index.html deleted file mode 100644 index bc1d505..0000000 --- a/survey_attachment/static/description/index.html +++ /dev/null @@ -1,21 +0,0 @@ -
-
-
-

Survey Attachment

-
-

This module allows you to upload file to survey !

-
-

Choose Type of question upload file

- -
-

Upload File here

-
- -
- -
- -
-
-
-
diff --git a/survey_attachment/static/description/survey.jpg b/survey_attachment/static/description/survey.jpg deleted file mode 100644 index 7d89241..0000000 Binary files a/survey_attachment/static/description/survey.jpg and /dev/null differ diff --git a/survey_attachment/templates/page.xml b/survey_attachment/templates/page.xml index 7c33902..4581a30 100644 --- a/survey_attachment/templates/page.xml +++ b/survey_attachment/templates/page.xml @@ -1,57 +1,10 @@ -