Browse Source

[REF] survey_custom_matrix

12.0
Rémi FRANÇOIS 4 years ago
parent
commit
157a0e5456
  1. 15
      survey_custom_matrix/COPYRIGHT
  2. 11
      survey_custom_matrix/LICENSE
  3. 4
      survey_custom_matrix/__init__.py
  4. 21
      survey_custom_matrix/__manifest__.py
  5. 1
      survey_custom_matrix/controllers/__init__.py
  6. 18
      survey_custom_matrix/controllers/main.py
  7. 52
      survey_custom_matrix/i18n/fr.po
  8. 43
      survey_custom_matrix/i18n/survey_custom_matrix.pot
  9. 1
      survey_custom_matrix/models/__init__.py
  10. 20
      survey_custom_matrix/models/survey_label.py
  11. 5
      survey_custom_matrix/models/survey_label_value.py
  12. 95
      survey_custom_matrix/models/survey_question.py
  13. 89
      survey_custom_matrix/models/survey_user_input_line.py
  14. 4
      survey_custom_matrix/reports/user_input.xml
  15. 8
      survey_custom_matrix/security/ir_model_access.xml
  16. BIN
      survey_custom_matrix/static/description/banner.jpg
  17. BIN
      survey_custom_matrix/static/description/call-icon.png
  18. 2
      survey_custom_matrix/static/description/color code.txt
  19. BIN
      survey_custom_matrix/static/description/features-icon.png
  20. BIN
      survey_custom_matrix/static/description/icon-2.png
  21. BIN
      survey_custom_matrix/static/description/icon-3.png
  22. BIN
      survey_custom_matrix/static/description/icon-4.png
  23. BIN
      survey_custom_matrix/static/description/icon-5.png
  24. BIN
      survey_custom_matrix/static/description/icon-6.png
  25. BIN
      survey_custom_matrix/static/description/icon.png
  26. BIN
      survey_custom_matrix/static/description/icon1.png
  27. 248
      survey_custom_matrix/static/description/index.html
  28. BIN
      survey_custom_matrix/static/description/logo.png
  29. BIN
      survey_custom_matrix/static/description/main_image.jpg
  30. BIN
      survey_custom_matrix/static/description/support-icon.png
  31. BIN
      survey_custom_matrix/static/description/survey_1.png
  32. BIN
      survey_custom_matrix/static/description/survey_10.png
  33. BIN
      survey_custom_matrix/static/description/survey_11.png
  34. BIN
      survey_custom_matrix/static/description/survey_12.png
  35. BIN
      survey_custom_matrix/static/description/survey_13.png
  36. BIN
      survey_custom_matrix/static/description/survey_2.png
  37. BIN
      survey_custom_matrix/static/description/survey_3.png
  38. BIN
      survey_custom_matrix/static/description/survey_4.png
  39. BIN
      survey_custom_matrix/static/description/survey_5.png
  40. BIN
      survey_custom_matrix/static/description/survey_6.png
  41. BIN
      survey_custom_matrix/static/description/survey_8.png
  42. BIN
      survey_custom_matrix/static/description/survey_9.png
  43. 43
      survey_custom_matrix/templates/matrix.xml
  44. 2
      survey_custom_matrix/views/survey_question.xml
  45. 6
      survey_custom_matrix/views/survey_user_input_line.xml

15
survey_custom_matrix/COPYRIGHT

@ -1,15 +0,0 @@
Most of the files are
Copyright (c) 2012-TODAY Kanak Infosystems LLP
Many files also contain contributions from third
parties. In this case the original copyright of
the contributions can be traced through the
history of the source version control system.
When that is not the case, the files contain a prominent
notice stating the original copyright and applicable
license, or come with their own dedicated COPYRIGHT
and/or LICENSE file.

11
survey_custom_matrix/LICENSE

@ -1,11 +0,0 @@
Kanak Infosystems LLP Proprietary License v1.0
This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from the authors, typically via Kanak Infosystems LLP Apps, or if you have received a written agreement from the authors of the Software (see the COPYRIGHT file).
You may develop Kanak Infosystems LLP modules that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the Kanak Infosystems LLP Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one).
It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software.
The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

4
survey_custom_matrix/__init__.py

@ -1,3 +1,3 @@
from . import models
# -*- coding: utf-8 -*-
from . import controllers
from . import models

21
survey_custom_matrix/__manifest__.py

@ -1,18 +1,5 @@
#################################################################################
# Author : Kanak Infosystems LLP. (<http://kanakinfosystems.com/>)
# Copyright(c): 2012-Present Kanak Infosystems LLP.
# All Rights Reserved.
#
#
# This program is copyright property of the author mentioned above.
# You can`t redistribute it and/or modify it.
#
#
# You should have received a copy of the License along with this program.
# If not, see <http://kanakinfosystems.com/license>
#################################################################################
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': "Survey custom matrix",
'version': '1.0',
@ -36,6 +23,6 @@ Custom Matrix Survey.
'views/survey_user_input_line.xml',
],
'application': True,
'price': 49,
'currency': 'EUR',
# 'price': 49,
# 'currency': 'EUR',
}

1
survey_custom_matrix/controllers/__init__.py

@ -1 +1,2 @@
# -*- coding: utf-8 -*-
from . import main

18
survey_custom_matrix/controllers/main.py

@ -1,15 +1,19 @@
# -*- coding: utf-8 -*-
import json
from odoo import http
from odoo.http import request
import logging
from odoo.addons.survey.controllers.main import Survey
import logging
_logger = logging.getLogger(__name__)
class Survey(Survey):
@http.route(['/survey/prefill/<model("survey.survey"):survey>/<string:token>',
'/survey/prefill/<model("survey.survey"):survey>/<string:token>/<model("survey.page"):page>'],
type='http', auth='public', website=True)
@http.route([
'/survey/prefill/<model("survey.survey"):survey>/<string:token>',
'/survey/prefill/<model("survey.survey"):survey>/<string:token>/<model("survey.page"):page>'],
type='http', auth='public', website=True)
def prefill(self, survey, token, page=None, **post):
UserInputLine = request.env['survey.user_input_line']
ret = {}
@ -23,7 +27,7 @@ class Survey(Survey):
if not answer.skipped:
answer_tag = '%s_%s_%s' % (answer.survey_id.id, answer.page_id.id, answer.question_id.id)
answer_value = None
if answer.question_id.matrix_subtype == 'custom_row':
if answer.question_id.matrix_subtype == 'custom':
if answer.answer_type == 'free_text':
answer_tag = "%s_%s_%s" % (answer_tag, answer.value_suggested_row.id, answer.value_suggested.id)
answer_value = answer.value_free_text
@ -38,7 +42,7 @@ class Survey(Survey):
answer_value = answer.value_date
elif answer.answer_type == 'dropdown':
answer_tag = "%s_%s_%s" % (answer_tag, answer.value_suggested_row.id, answer.value_suggested.id)
answer_value = answer.value_dropdown.id
answer_value = answer.value_id.id
elif answer.answer_type == 'suggestion' and not answer.value_suggested_row:
answer_tag = "%s_%s_%s" % (answer_tag, answer.value_suggested_row.id, answer.value_suggested.id)
answer_value = answer.value_suggested.id

52
survey_custom_matrix/i18n/fr.po

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-04-06 15:06+0000\n"
"PO-Revision-Date: 2020-04-06 15:06+0000\n"
"POT-Creation-Date: 2020-11-09 12:08+0000\n"
"PO-Revision-Date: 2020-11-09 12:08+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -36,12 +36,12 @@ msgid "Checkbox"
msgstr "Case à cocher"
#. module: survey_custom_matrix
#: model:ir.model.fields,field_description:survey_custom_matrix.field_dp_attributes_value__create_uid
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_label_value__create_uid
msgid "Created by"
msgstr "Créé par"
#. module: survey_custom_matrix
#: model:ir.model.fields,field_description:survey_custom_matrix.field_dp_attributes_value__create_date
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_label_value__create_date
msgid "Created on"
msgstr "Créé le"
@ -53,10 +53,10 @@ msgstr "Matrice personnalisée"
#. module: survey_custom_matrix
#: selection:survey.user_input_line,answer_type:0
msgid "Date"
msgstr "Date"
msgstr ""
#. module: survey_custom_matrix
#: model:ir.model.fields,field_description:survey_custom_matrix.field_dp_attributes_value__display_name
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_label_value__display_name
msgid "Display Name"
msgstr "Nom affiché"
@ -71,35 +71,31 @@ msgid "Free Text"
msgstr "Texte libre"
#. module: survey_custom_matrix
#: model:ir.model.fields,field_description:survey_custom_matrix.field_dp_attributes_value__id
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_label_value__id
msgid "ID"
msgstr "ID"
msgstr ""
#. module: survey_custom_matrix
#: model:ir.model.fields,field_description:survey_custom_matrix.field_dp_attributes_value____last_update
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_label_value____last_update
msgid "Last Modified on"
msgstr "Dernière modification le"
#. module: survey_custom_matrix
#: model:ir.model.fields,field_description:survey_custom_matrix.field_dp_attributes_value__write_uid
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_label_value__write_uid
msgid "Last Updated by"
msgstr "Dernière mise à jour par"
#. module: survey_custom_matrix
#: model:ir.model.fields,field_description:survey_custom_matrix.field_dp_attributes_value__write_date
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_label_value__write_date
msgid "Last Updated on"
msgstr "Dernière mise à jour le"
#. module: survey_custom_matrix
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_question__matrix_subtype
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_user_input_line__matrix_subtype
msgid "Matrix Type"
msgstr "Type de matrice"
#. module: survey_custom_matrix
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_user_input_line__matrix_subtype_id
msgid "Matrix subtype"
msgstr "Sous-type de matrice"
#. module: survey_custom_matrix
#: selection:survey.label,type:0
msgid "Multiple Lines Text Box"
@ -111,7 +107,7 @@ msgid "Multiple choices per row"
msgstr "Plusieurs choix par ligne"
#. module: survey_custom_matrix
#: model:ir.model.fields,field_description:survey_custom_matrix.field_dp_attributes_value__name
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_label_value__name
msgid "Name"
msgstr "Nom"
@ -131,7 +127,7 @@ msgid "One choice per row"
msgstr "Un choix par ligne"
#. module: survey_custom_matrix
#: model_terms:ir.ui.view,arch_db:survey_custom_matrix.survey_user_input_custom_form
#: model_terms:ir.ui.view,arch_db:survey_custom_matrix.survey_user_input_form
msgid "Print PDF Answers"
msgstr "Imprimer les réponses en PDF"
@ -143,7 +139,7 @@ msgstr "Ligne de texte unique"
#. module: survey_custom_matrix
#: selection:survey.user_input_line,answer_type:0
msgid "Suggestion"
msgstr "Suggestion"
msgstr ""
#. module: survey_custom_matrix
#: model:ir.model,name:survey_custom_matrix.model_survey_label
@ -167,20 +163,20 @@ msgstr "Texte"
#. module: survey_custom_matrix
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_label__type
msgid "Type of Question"
msgid "Type of question"
msgstr "Type de question"
#. module: survey_custom_matrix
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_user_input_line__value_dropdown
msgid "Value Dropdown"
msgstr "Valeur possible"
#: model:ir.model,name:survey_custom_matrix.model_survey_label_value
msgid "Value"
msgstr "Valeur"
#. module: survey_custom_matrix
#: model:ir.model,name:survey_custom_matrix.model_dp_attributes_value
msgid "survey.label.value"
msgstr ""
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_user_input_line__value_id
msgid "Value Dropdown"
msgstr "Valeur"
#. module: survey_custom_matrix
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_label__dpvalues
msgid "values"
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_label__value_ids
msgid "Values"
msgstr "Valeurs"

43
survey_custom_matrix/i18n/custom_matrix_survey.pot → survey_custom_matrix/i18n/survey_custom_matrix.pot

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-04-06 15:07+0000\n"
"PO-Revision-Date: 2020-04-06 15:07+0000\n"
"POT-Creation-Date: 2020-11-09 12:09+0000\n"
"PO-Revision-Date: 2020-11-09 12:09+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -36,12 +36,12 @@ msgid "Checkbox"
msgstr ""
#. module: survey_custom_matrix
#: model:ir.model.fields,field_description:survey_custom_matrix.field_dp_attributes_value__create_uid
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_label_value__create_uid
msgid "Created by"
msgstr ""
#. module: survey_custom_matrix
#: model:ir.model.fields,field_description:survey_custom_matrix.field_dp_attributes_value__create_date
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_label_value__create_date
msgid "Created on"
msgstr ""
@ -56,7 +56,7 @@ msgid "Date"
msgstr ""
#. module: survey_custom_matrix
#: model:ir.model.fields,field_description:survey_custom_matrix.field_dp_attributes_value__display_name
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_label_value__display_name
msgid "Display Name"
msgstr ""
@ -71,35 +71,31 @@ msgid "Free Text"
msgstr ""
#. module: survey_custom_matrix
#: model:ir.model.fields,field_description:survey_custom_matrix.field_dp_attributes_value__id
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_label_value__id
msgid "ID"
msgstr ""
#. module: survey_custom_matrix
#: model:ir.model.fields,field_description:survey_custom_matrix.field_dp_attributes_value____last_update
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_label_value____last_update
msgid "Last Modified on"
msgstr ""
#. module: survey_custom_matrix
#: model:ir.model.fields,field_description:survey_custom_matrix.field_dp_attributes_value__write_uid
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_label_value__write_uid
msgid "Last Updated by"
msgstr ""
#. module: survey_custom_matrix
#: model:ir.model.fields,field_description:survey_custom_matrix.field_dp_attributes_value__write_date
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_label_value__write_date
msgid "Last Updated on"
msgstr ""
#. module: survey_custom_matrix
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_question__matrix_subtype
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_user_input_line__matrix_subtype
msgid "Matrix Type"
msgstr ""
#. module: survey_custom_matrix
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_user_input_line__matrix_subtype_id
msgid "Matrix subtype"
msgstr ""
#. module: survey_custom_matrix
#: selection:survey.label,type:0
msgid "Multiple Lines Text Box"
@ -111,7 +107,7 @@ msgid "Multiple choices per row"
msgstr ""
#. module: survey_custom_matrix
#: model:ir.model.fields,field_description:survey_custom_matrix.field_dp_attributes_value__name
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_label_value__name
msgid "Name"
msgstr ""
@ -131,7 +127,7 @@ msgid "One choice per row"
msgstr ""
#. module: survey_custom_matrix
#: model_terms:ir.ui.view,arch_db:survey_custom_matrix.survey_user_input_custom_form
#: model_terms:ir.ui.view,arch_db:survey_custom_matrix.survey_user_input_form
msgid "Print PDF Answers"
msgstr ""
@ -167,21 +163,20 @@ msgstr ""
#. module: survey_custom_matrix
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_label__type
msgid "Type of Question"
msgid "Type of question"
msgstr ""
#. module: survey_custom_matrix
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_user_input_line__value_dropdown
msgid "Value Dropdown"
#: model:ir.model,name:survey_custom_matrix.model_survey_label_value
msgid "Value"
msgstr ""
#. module: survey_custom_matrix
#: model:ir.model,name:survey_custom_matrix.model_dp_attributes_value
msgid "survey.label.value"
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_user_input_line__value_id
msgid "Value Dropdown"
msgstr ""
#. module: survey_custom_matrix
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_label__dpvalues
msgid "values"
#: model:ir.model.fields,field_description:survey_custom_matrix.field_survey_label__value_ids
msgid "Values"
msgstr ""

1
survey_custom_matrix/models/__init__.py

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from . import survey_label
from . import survey_label_value
from . import survey_question

20
survey_custom_matrix/models/survey_label.py

@ -1,16 +1,18 @@
from odoo import models, fields, _
# -*- coding: utf-8 -*-
from odoo import models, fields
TYPES = [
('free_text', _('Multiple Lines Text Box')),
('textbox', _('Single Line Text Box')),
('numerical_box', _('Numerical Value')),
('dropdown', _('Dropdown')),
('checkbox', _('Checkbox')),
('free_text', 'Multiple Lines Text Box'),
('textbox', 'Single Line Text Box'),
('numerical_box', 'Numerical Value'),
# ('date', 'Date'),
('dropdown', 'Dropdown'),
('checkbox', 'Checkbox'),
]
class SurveyLabel(models.Model):
_inherit = 'survey.label'
type = fields.Selection(selection=TYPES, string='Type of Question', default="checkbox")
dpvalues = fields.Many2many(comodel_name='survey.label.value', string="values")
type = fields.Selection(selection=TYPES, string="Type of question", default="checkbox")
value_ids = fields.Many2many(comodel_name='survey.label.value', string="Values")

5
survey_custom_matrix/models/survey_label_value.py

@ -1,8 +1,9 @@
# -*- coding: utf-8 -*-
from odoo import models, fields
class SurveyLabelValue(models.Model):
_name = 'survey.label.value'
_description = "Valeur"
_description = "Value"
name = fields.Char(strring="Name")
name = fields.Char(string="Name")

95
survey_custom_matrix/models/survey_question.py

@ -1,18 +1,12 @@
# -*- coding: utf-8 -*-
from odoo import api, fields, models
def dict_keys_startswith(dictionary, string):
"""Returns a dictionary containing the elements of <dict> whose keys start with <string>.
.. note::
This function uses dictionary comprehensions (Python >= 2.7)
"""
return {k: v for k, v in dictionary.items() if k.startswith(string)}
from odoo.addons.survey.models.survey import dict_keys_startswith
class SurveyQuestion(models.Model):
_inherit = 'survey.question'
matrix_subtype = fields.Selection([('simple', 'One choice per row'),
('multiple', 'Multiple choices per row'), ('custom_row', 'Custom Matrix')], string='Matrix Type', default='simple')
matrix_subtype = fields.Selection(selection_add=[('custom', 'Custom Matrix')])
@api.multi
def validate_matrix(self, post, answer_tag):
@ -27,7 +21,7 @@ class SurveyQuestion(models.Model):
answer_number = len(answer_candidates)
elif self.matrix_subtype == 'multiple':
answer_number = len({sk.rsplit('_', 1)[0] for sk in answer_candidates})
elif self.matrix_subtype == 'custom_row':
elif self.matrix_subtype == 'custom':
answer_number = len({sk.rsplit('_', 1)[0] for sk in answer_candidates})
else:
raise RuntimeError("Invalid matrix subtype")
@ -35,84 +29,3 @@ class SurveyQuestion(models.Model):
if answer_number != lines_number:
errors.update({answer_tag: self.constr_error_msg})
return errors
class SurveyUserInputLine(models.Model):
_inherit = 'survey.user_input_line'
answer_type = fields.Selection([
('text', 'Text'),
('number', 'Number'),
('date', 'Date'),
('free_text', 'Free Text'),
('suggestion', 'Suggestion'), ('dropdown', 'Dropdown')], string='Answer Type')
value_dropdown = fields.Many2one('survey.label.value', string="Value Dropdown")
matrix_subtype_id = fields.Selection(related='question_id.matrix_subtype', string="Matrix subtype")
@api.model
def save_line_matrix(self, user_input_id, question, post, answer_tag):
vals = {
'user_input_id': user_input_id,
'question_id': question.id,
'survey_id': question.survey_id.id,
'skipped': False
}
old_uil = self.search([
('user_input_id', '=', user_input_id),
('survey_id', '=', question.survey_id.id),
('question_id', '=', question.id)
])
old_uil.sudo().unlink()
no_answers = True
ca_dict = dict_keys_startswith(post, answer_tag + '_')
comment_answer = ca_dict.pop(("%s_%s" % (answer_tag, 'comment')), '').strip()
if comment_answer:
vals.update({'answer_type': 'text', 'value_text': comment_answer})
self.create(vals)
no_answers = False
if question.matrix_subtype == 'simple':
for row in question.labels_ids_2:
a_tag = "%s_%s" % (answer_tag, row.id)
if a_tag in ca_dict:
no_answers = False
vals.update({'answer_type': 'suggestion', 'value_suggested': ca_dict[a_tag], 'value_suggested_row': row.id})
self.create(vals)
elif question.matrix_subtype == 'multiple':
for col in question.labels_ids:
for row in question.labels_ids_2:
a_tag = "%s_%s_%s" % (answer_tag, row.id, col.id)
if a_tag in ca_dict:
no_answers = False
vals.update({'answer_type': 'suggestion', 'value_suggested': col.id, 'value_suggested_row': row.id})
self.create(vals)
elif question.matrix_subtype == 'custom_row':
for col in question.labels_ids:
for row in question.labels_ids_2:
a_tag = "%s_%s_%s" % (answer_tag, row.id, col.id)
if a_tag in ca_dict:
no_answers = False
if post.get(a_tag):
sline = a_tag.split('_')[-1]
label_obj = question.labels_ids.browse(int(sline))
if label_obj.type == 'textbox':
vals.update({'answer_type': 'text', 'value_suggested': col.id, 'value_suggested_row': row.id, 'value_text': post.get(a_tag)})
elif label_obj.type == 'free_text':
vals.update({'answer_type': 'free_text', 'value_suggested': col.id, 'value_suggested_row': row.id, 'value_free_text': post.get(a_tag)})
elif label_obj.type == 'numerical_box':
vals.update({'answer_type': 'number', 'value_suggested': col.id, 'value_suggested_row': row.id, 'value_number': post.get(a_tag)})
elif label_obj.type == 'date':
vals.update({'answer_type': 'date', 'value_suggested': col.id, 'value_suggested_row': row.id, 'value_date': post.get(a_tag)})
elif label_obj.type == 'dropdown':
vals.update({'answer_type': 'dropdown', 'value_suggested': col.id, 'value_suggested_row': row.id, 'value_dropdown': int(post.get(a_tag))})
else:
vals.update({'answer_type': 'suggestion', 'value_suggested': col.id, 'value_suggested_row': row.id})
self.create(vals)
if no_answers:
vals.update({'answer_type': None, 'skipped': True})
self.create(vals)
return True

89
survey_custom_matrix/models/survey_user_input_line.py

@ -1,25 +1,14 @@
# -*- coding: utf-8 -*-
from odoo import models, fields, api
def dict_keys_startswith(dictionary, string):
"""Returns a dictionary containing the elements of <dict> whose keys start with <string>.
.. note::
This function uses dictionary comprehensions (Python >= 2.7)
"""
return {k: v for k, v in dictionary.items() if k.startswith(string)}
from odoo.addons.survey.models.survey import dict_keys_startswith
class SurveyUserInputLine(models.Model):
_inherit = 'survey.user_input_line'
answer_type = fields.Selection([
('text', 'Text'),
('number', 'Number'),
('date', 'Date'),
('free_text', 'Free Text'),
('suggestion', 'Suggestion'), ('dropdown', 'Dropdown')], string='Answer Type')
value_dropdown = fields.Many2one('survey.label.value', string="Value Dropdown")
matrix_subtype_id = fields.Selection(related='question_id.matrix_subtype', string="Matrix subtype")
answer_type = fields.Selection(selection_add=[('dropdown', 'Dropdown')], string='Answer Type')
matrix_subtype = fields.Selection(related='question_id.matrix_subtype')
value_id = fields.Many2one('survey.label.value', string="Value Dropdown")
@api.model
def save_line_matrix(self, user_input_id, question, post, answer_tag):
@ -29,19 +18,22 @@ class SurveyUserInputLine(models.Model):
'survey_id': question.survey_id.id,
'skipped': False
}
old_uil = self.search([
suil = self.search([
('user_input_id', '=', user_input_id),
('survey_id', '=', question.survey_id.id),
('question_id', '=', question.id)
])
old_uil.sudo().unlink()
suil.sudo().unlink()
no_answers = True
ca_dict = dict_keys_startswith(post, answer_tag + '_')
comment_answer = ca_dict.pop(("%s_%s" % (answer_tag, 'comment')), '').strip()
if comment_answer:
vals.update({'answer_type': 'text', 'value_text': comment_answer})
vals.update({
'answer_type': 'text',
'value_text': comment_answer,
})
self.create(vals)
no_answers = False
@ -50,7 +42,11 @@ class SurveyUserInputLine(models.Model):
a_tag = "%s_%s" % (answer_tag, row.id)
if a_tag in ca_dict:
no_answers = False
vals.update({'answer_type': 'suggestion', 'value_suggested': ca_dict[a_tag], 'value_suggested_row': row.id})
vals.update({
'answer_type': 'suggestion',
'value_suggested': ca_dict[a_tag],
'value_suggested_row': row.id,
})
self.create(vals)
elif question.matrix_subtype == 'multiple':
@ -59,10 +55,14 @@ class SurveyUserInputLine(models.Model):
a_tag = "%s_%s_%s" % (answer_tag, row.id, col.id)
if a_tag in ca_dict:
no_answers = False
vals.update({'answer_type': 'suggestion', 'value_suggested': col.id, 'value_suggested_row': row.id})
vals.update({
'answer_type': 'suggestion',
'value_suggested': col.id,
'value_suggested_row': row.id,
})
self.create(vals)
elif question.matrix_subtype == 'custom_row':
elif question.matrix_subtype == 'custom':
for col in question.labels_ids:
for row in question.labels_ids_2:
a_tag = "%s_%s_%s" % (answer_tag, row.id, col.id)
@ -72,20 +72,51 @@ class SurveyUserInputLine(models.Model):
sline = a_tag.split('_')[-1]
label_obj = question.labels_ids.browse(int(sline))
if label_obj.type == 'textbox':
vals.update({'answer_type': 'text', 'value_suggested': col.id, 'value_suggested_row': row.id, 'value_text': post.get(a_tag)})
vals.update({
'answer_type': 'text',
'value_suggested': col.id,
'value_suggested_row': row.id,
'value_text': post.get(a_tag),
})
elif label_obj.type == 'free_text':
vals.update({'answer_type': 'free_text', 'value_suggested': col.id, 'value_suggested_row': row.id, 'value_free_text': post.get(a_tag)})
vals.update({
'answer_type': 'free_text',
'value_suggested': col.id,
'value_suggested_row': row.id,
'value_free_text': post.get(a_tag),
})
elif label_obj.type == 'numerical_box':
vals.update({'answer_type': 'number', 'value_suggested': col.id, 'value_suggested_row': row.id, 'value_number': post.get(a_tag)})
vals.update({
'answer_type': 'number',
'value_suggested': col.id,
'value_suggested_row': row.id,
'value_number': post.get(a_tag),
})
elif label_obj.type == 'date':
vals.update({'answer_type': 'date', 'value_suggested': col.id, 'value_suggested_row': row.id, 'value_date': post.get(a_tag)})
vals.update({
'answer_type': 'date',
'value_suggested': col.id,
'value_suggested_row': row.id,
'value_date': post.get(a_tag),
})
elif label_obj.type == 'dropdown':
vals.update({'answer_type': 'dropdown', 'value_suggested': col.id, 'value_suggested_row': row.id, 'value_dropdown': int(post.get(a_tag))})
vals.update({
'answer_type': 'dropdown',
'value_suggested': col.id,
'value_suggested_row': row.id,
'value_id': int(post.get(a_tag)),
})
else:
vals.update({'answer_type': 'suggestion', 'value_suggested': col.id, 'value_suggested_row': row.id})
vals.update({
'answer_type': 'suggestion',
'value_suggested': col.id,
'value_suggested_row': row.id})
self.create(vals)
if no_answers:
vals.update({'answer_type': None, 'skipped': True})
vals.update({
'answer_type': None,
'skipped': True,
})
self.create(vals)
return True

4
survey_custom_matrix/reports/user_input.xml

@ -11,7 +11,7 @@
<t t-set="questions" t-value="doc.user_input_line_ids.mapped('question_id')"/>
<!-- <h3 class="text-center"><t t-esc="doc."/></h3> -->
<t t-foreach="questions" t-as="qs">
<t t-if="qs.matrix_subtype == 'custom_row'">
<t t-if="qs.matrix_subtype == 'custom'">
<h4 class="text-center mt16 mb16" t-field="qs.question"/>
<table class="table" style="width:100%;">
<thead>
@ -45,7 +45,7 @@
<span class="fa fa-check"/>
</t>
<t t-if="ans.answer_type == 'dropdown'">
<span t-field="ans.value_dropdown"/>
<span t-field="ans.value_id"/>
</t>
</td>
<t t-set="flag" t-value="true"/>

8
survey_custom_matrix/security/ir_model_access.xml

@ -1,7 +1,7 @@
<odoo>
<record id="survey_label_value_all_r" model="ir.model.access">
<field name="name">survey.label.value All R</field>
<record id="survey_label_value_all" model="ir.model.access">
<field name="name">survey.label.value All</field>
<field name="model_id" ref="survey_custom_matrix.model_survey_label_value"/>
<field name="perm_read">1</field>
<field name="perm_write">0</field>
@ -9,8 +9,8 @@
<field name="perm_unlink">0</field>
</record>
<record id="survey_label_value_manager_rwcu" model="ir.model.access">
<field name="name">survey.label.value Survey Manager RWCU</field>
<record id="survey_label_value_survey_manager" model="ir.model.access">
<field name="name">survey.label.value Survey Manager</field>
<field name="model_id" ref="survey_custom_matrix.model_survey_label_value"/>
<field name="group_id" ref="survey.group_survey_manager"/>
<field name="perm_read">1</field>

BIN
survey_custom_matrix/static/description/banner.jpg

Before

Width: 750  |  Height: 375  |  Size: 92 KiB

BIN
survey_custom_matrix/static/description/call-icon.png

Before

Width: 29  |  Height: 28  |  Size: 771 B

2
survey_custom_matrix/static/description/color code.txt

@ -1,2 +0,0 @@
Blue color: 123246
Red Color: dc1d1d

BIN
survey_custom_matrix/static/description/features-icon.png

Before

Width: 25  |  Height: 25  |  Size: 598 B

BIN
survey_custom_matrix/static/description/icon-2.png

Before

Width: 97  |  Height: 96  |  Size: 3.7 KiB

BIN
survey_custom_matrix/static/description/icon-3.png

Before

Width: 90  |  Height: 92  |  Size: 2.2 KiB

BIN
survey_custom_matrix/static/description/icon-4.png

Before

Width: 90  |  Height: 92  |  Size: 2.7 KiB

BIN
survey_custom_matrix/static/description/icon-5.png

Before

Width: 90  |  Height: 92  |  Size: 2.3 KiB

BIN
survey_custom_matrix/static/description/icon-6.png

Before

Width: 90  |  Height: 92  |  Size: 2.1 KiB

BIN
survey_custom_matrix/static/description/icon.png

Before

Width: 500  |  Height: 500  |  Size: 16 KiB

BIN
survey_custom_matrix/static/description/icon1.png

Before

Width: 95  |  Height: 104  |  Size: 2.5 KiB

248
survey_custom_matrix/static/description/index.html

@ -1,248 +0,0 @@
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">
Matrix Survey
</h2>
</div>
</div>
</section>
<section class="oe_container" style="background-color: #eeeeee;">
<div class="oe_row oe_spaced text-center">
<div class="oe_span12">
<h2 class="oe_slogan">Create Survey &amp; Add Survey pages</h2>
</div>
<div class="oe_span12">
<div class="oe_row_img oe_centered">
<div class="">
<img src="survey_1.png" class="oe_screenshot oe_centered" style="max-height: 400px;"/>
</div>
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced text-center">
<div class="oe_span12">
<h2 class="oe_slogan">Add questions for survey page</h2>
<div class="oe_row_img oe_centered">
<div class="">
<img src="survey_2.png" class="oe_screenshot oe_centered" style="max-height: 400px;"/>
</div>
</div>
</div>
</div>
</section>
<section class="oe_container" style="background-color: #eeeeee;">
<div class="oe_row oe_spaced text-center">
<div class="oe_span12">
<h2 class="oe_slogan">Set question type as "matrix"</h2>
<div class="oe_row_img oe_centered">
<div class="">
<img src="survey_3.png" class="oe_screenshot oe_centered" style="max-height: 400px;"/>
</div>
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced text-center">
<div class="oe_span12">
<h2 class="oe_slogan">Set type of matrix</h2>
<div class="oe_row_img oe_centered">
<div class="">
<img src="survey_4.png" class="oe_screenshot oe_centered" style="max-height: 400px;"/>
</div>
</div>
</div>
</div>
</section>
<section class="oe_container" style="background-color: #eeeeee;">
<div class="oe_row oe_spaced text-center">
<div class="oe_span12">
<h3 class="oe_slogan">
Add answer's choices &amp; Set display type of questions <br/>
with different types of input methods
</h3>
<div class="oe_row_img oe_centered">
<div class="">
<img src="survey_5.png" class="oe_screenshot oe_centered" style="max-height: 400px;"/>
</div>
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced text-center">
<div class="oe_span12">
<h2 class="oe_slogan">Add multiple header rows</h2>
<div class="oe_row_img oe_centered">
<div class="">
<img src="survey_6.png" class="oe_screenshot oe_centered" style="max-height: 400px;"/>
</div>
</div>
</div>
</div>
</section>
<section class="oe_container" style="background-color: #eeeeee;">
<div class="oe_row oe_spaced text-center">
<div class="oe_span12">
<h2 class="oe_slogan">Fill survey</h2>
<div class="oe_row_img oe_centered">
<div class="">
<img src="survey_8.png" class="oe_screenshot oe_centered" style="max-height: 400px;"/>
</div>
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced text-center">
<div class="oe_span12">
<h2 class="oe_slogan">View filled answers of survey</h2>
<div class="oe_row_img oe_centered">
<div class="">
<img src="survey_9.png" class="oe_screenshot oe_centered" style="max-height: 400px;"/>
</div>
</div>
</div>
</div>
</section>
<section class="oe_container" style="background-color: #eeeeee;">
<div class="oe_row oe_spaced text-center">
<div class="oe_span12">
<h2 class="oe_slogan">Get print in .pdf</h2>
<div class="oe_row_img oe_centered">
<div class="oe_span6">
<img src="survey_10.png" class="oe_screenshot oe_centered" style="max-height: 400px;"/>
</div>
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced text-center">
<div class="oe_span12">
<h2 class="oe_slogan">PDF view</h2>
<div class="oe_row_img oe_centered">
<div class="oe_span6">
<img src="survey_11.png" class="oe_screenshot oe_centered" style="max-height: 400px;"/>
</div>
</div>
</div>
</div>
</section>
<section class="oe_container" style="background-color: #eeeeee;">
<div class="oe_row oe_spaced text-center">
<div class="oe_span12">
<h2 class="oe_slogan">Print filled answers</h2>
<div class="oe_row_img oe_centered">
<div class="oe_span6">
<img src="survey_12.png" class="oe_screenshot oe_centered" style="max-height: 400px;"/>
</div>
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced text-center">
<div class="oe_span12">
<h2 class="oe_slogan">Filled Answers</h2>
<div class="oe_row_img oe_centered">
<div class="oe_span6">
<img src="survey_13.png" class="oe_screenshot oe_centered" style="max-height: 400px;"/>
</div>
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="row">
<div class="col-sm-12">
<div class="laptop-wrapper">
<iframe width="560" height="315" src="https://www.youtube.com/embed/F7u41nqf_iA" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
</div>
</div>
</div>
</section>
<section>
<div class="oe_row">
<div class="container-fluid">
<div class="oe_row">
<div class="col-md-12 col-xs-12 col-sm-12 mt32 mb32 text-center">
<img src="logo.png" style="height:100px;">
</div>
</div>
<div class="oe_row oe_screenshot" style="box-shadow: 3px 4px 25px 6px rgba(0, 0, 0, 0.2);;border-radius: 8px; background: #ECEDF0;">
<div class="col-sm-12">
<div class="text-center">
<a href="https://kanakinfosystems.com/kanak_aboutus"><h3 class="oe_slogan" style="border-bottom: 1px solid #123246; margin-top: 8px; font-size:33px; color:#123246; opacity:1; font-family:segoeuib">About kanak Infosystems</h3></a>
</div>
</div>
<div class="col-sm-12">
<h5 class="oe_slogan" style="margin-top: -9px; color:#123246;margin-bottom: 12px; opacity: 0.6; font-family:segoeuiz;"><i><b>"We are groupies wrapped in Creativity, Skills and Innovation"</b></i></h5>
<p style="font-family:segoeui">We are authorized IT company to offer advanced, hight quality and affordable IT solutions. We have years of rich experience in the field of ODOO Development, ERP Solutions, Web Development, Mobile Apps, Web Designing and Digital marketing. Around a decade are offering quality assured and 100% customer satisfaction services to global clientele.</p>
<p style="font-family:segoeui">Our highly experienced and devoted team of professionals works with there heart, passion and talent to provide the most dedicated IT Business Solutions to our valuable clients globally. Our team works on the real words "Dedication,"Timely Deliverables",And "Happy Clients"!</p>
</div>
</div>
<div class="oe_row col-md-12 col-sm-12">
<div class="text-center">
<h2 style="color:#123246;font-family:segoeuib"> What We Do</h2>
</div>
</div>
<div class="row">
<div class="col-md-2 col-sm-2">
<img src="icon1.png">
<h6 style="margin-top: -10px;font-size: 9px;color:#123246;font-family:">Odoo Customization</h6>
</div>
<div class="col-md-2 col-sm-2">
<img src="icon-2.png">
<h6 style="margin-top: -1px;font-size: 9px;color:#123246;font-family:">Odoo Code Migration</h6>
</div>
<div class="col-md-2 col-sm-2">
<img src="icon-3.png">
<h6 style="margin-top: -1px;font-size: 9px;color:#123246;font-family:">Odoo Mobile App</h6>
</div>
<div class="col-md-2 col-sm-2">
<img src="icon-4.png">
<h6 style="margin-top: -1px;font-size: 9px;color:#123246;font-family:">Odoo DB Migration</h6>
</div>
<div class="col-md-2 col-sm-2">
<img src="icon-5.png">
<h6 style="margin-top: -1px;font-size: 9px;color:#123246;font-family:">Odoo Web Development</h6>
</div>
<div class="col-md-2 col-sm-2">
<img src="icon-6.png">
<h6 style="margin-top: -1px;font-size: 9px;color:#123246;font-family:">Odoo Themes</h6>
</div>
</div>
<div class="oe_row">
<div class="text-center" style="text-align: center;">
<a style="color:#dc1d1d; border:1px solid #dc1d1d; width:170px;" class="btn btn-lg" rel="nofollow" href="https://kanakinfosystems.com/contactus" target="_blank">
Contact Us
</a>
</div>
</div>
<div class="oe_row" style="box-shadow: 3px 5px 18px 6px rgba(0, 0, 0, 0.2);;border-radius: 8px; background: #ECEDF0; height:50px">
<div class="oe_row">
<div class="col-md-12 col-sm-12" style="padding-top: 10px;padding-left: 40px;">
<div class="col-md-4 col-sm-4" style="float: left; text-align: center;">
<span><img src="call-icon.png"/></span>
<span>Help</span>
</div>
<div class="col-md-4 col-sm-4" style="float: left; text-align: center;">
<span><img src="support-icon.png"/></span>
<span>Support</span>
</div>
<div class="col-md-4 col-sm-4" style="float: left; text-align: center;">
<span><img src="support-icon.png"/></span>
<span>Request New Features</span>
</div>
</div>
</div>
</div>
</div>
</div>
</section>

BIN
survey_custom_matrix/static/description/logo.png

Before

Width: 261  |  Height: 123  |  Size: 15 KiB

BIN
survey_custom_matrix/static/description/main_image.jpg

Before

Width: 750  |  Height: 375  |  Size: 89 KiB

BIN
survey_custom_matrix/static/description/support-icon.png

Before

Width: 28  |  Height: 28  |  Size: 846 B

BIN
survey_custom_matrix/static/description/survey_1.png

Before

Width: 1351  |  Height: 608  |  Size: 108 KiB

BIN
survey_custom_matrix/static/description/survey_10.png

Before

Width: 1351  |  Height: 608  |  Size: 134 KiB

BIN
survey_custom_matrix/static/description/survey_11.png

Before

Width: 1351  |  Height: 608  |  Size: 78 KiB

BIN
survey_custom_matrix/static/description/survey_12.png

Before

Width: 1351  |  Height: 608  |  Size: 133 KiB

BIN
survey_custom_matrix/static/description/survey_13.png

Before

Width: 1351  |  Height: 608  |  Size: 79 KiB

BIN
survey_custom_matrix/static/description/survey_2.png

Before

Width: 1351  |  Height: 608  |  Size: 88 KiB

BIN
survey_custom_matrix/static/description/survey_3.png

Before

Width: 1351  |  Height: 608  |  Size: 109 KiB

BIN
survey_custom_matrix/static/description/survey_4.png

Before

Width: 1351  |  Height: 608  |  Size: 99 KiB

BIN
survey_custom_matrix/static/description/survey_5.png

Before

Width: 1351  |  Height: 608  |  Size: 106 KiB

BIN
survey_custom_matrix/static/description/survey_6.png

Before

Width: 1351  |  Height: 608  |  Size: 77 KiB

BIN
survey_custom_matrix/static/description/survey_8.png

Before

Width: 1351  |  Height: 608  |  Size: 76 KiB

BIN
survey_custom_matrix/static/description/survey_9.png

Before

Width: 1351  |  Height: 608  |  Size: 65 KiB

43
survey_custom_matrix/templates/matrix.xml

@ -15,34 +15,25 @@
<th><span t-field="row_label.value"/></th>
<td t-foreach="question.labels_ids" t-as="col_label">
<input t-if="question.matrix_subtype == 'simple'" type="radio" t-att-name="'%s_%s' % (prefix, row_label.id)" t-att-value='col_label.id'/>
<t t-if="question.matrix_subtype == 'custom_row'">
<t t-if="col_label.type == 'textbox'">
<input type="text" class="form-control" t-att-name="'%s_%s_%s' % (prefix, row_label.id, col_label.id)"/>
</t>
<t t-if="col_label.type == 'free_text'">
<textarea class="form-control" rows="3" t-att-name="'%s_%s_%s' % (prefix, row_label.id, col_label.id)"></textarea>
</t>
<t t-if="col_label.type == 'numerical_box'">
<input type="number" step="any" class="form-control" t-att-name="'%s_%s_%s' % (prefix, row_label.id, col_label.id)"/>
</t>
<t t-if="col_label.type == 'date'">
<div class='input-group date'>
<input type="text" date="true" class="form-control date" t-att-name="'%s_%s_%s' % (prefix, row_label.id, col_label.id)"/>
<input t-if="question.matrix_subtype == 'multiple'" type="checkbox" t-att-name="'%s_%s_%s' % (prefix, row_label.id, col_label.id)" t-att-value='col_label.id'/>
<t t-if="question.matrix_subtype == 'custom'">
<textarea t-if="col_label.type == 'free_text'" class="form-control" rows="3" t-att-name="'%s_%s_%s' % (prefix, row_label.id, col_label.id)"></textarea>
<input t-if="col_label.type == 'textbox'" type="text" class="form-control" t-att-name="'%s_%s_%s' % (prefix, row_label.id, col_label.id)"/>
<input t-if="col_label.type == 'numerical_box'" type="number" step="any" class="form-control" t-att-name="'%s_%s_%s' % (prefix, row_label.id, col_label.id)"/>
<!-- <div t-if="col_label.type == 'date'" class='input-group date' t-attf-id="#datetimepicker_#{question.id}_#{row_label.id}_#{col_label.id}" data-target-input="nearest">
<input type="text" class="form-control datetimepicker-input" t-attf-data-target="#datetimepicker_#{question.id}_#{row_label.id}_#{col_label.id}" t-att-name="'%s_%s_%s' % (prefix, row_label.id, col_label.id)"/>
<div class="input-group-append" t-attf-data-target="#datetimepicker_#{question.id}_#{row_label.id}_#{col_label.id}" data-toggle="datetimepicker">
<div class="input-group-text"><i class="fa fa-calendar"></i></div>
</div>
</t>
<t t-if="col_label.type == 'dropdown'">
<select t-att-name="'%s_%s_%s' % (prefix, row_label.id, col_label.id)" class="form-control" id="seldpbox1">
<option></option>
<t t-foreach="col_label.dpvalues" t-as="dpv">
<option t-att-value="dpv.id"><t t-esc="dpv.name"/></option>
</t>
</select>
</t>
<t t-if="col_label.type == 'checkbox'">
<input type="checkbox" t-att-name="'%s_%s_%s' % (prefix, row_label.id, col_label.id)" t-att-value='col_label.id'/>
</t>
</div> -->
<select t-if="col_label.type == 'dropdown'" t-att-name="'%s_%s_%s' % (prefix, row_label.id, col_label.id)" class="form-control" id="seldpbox1">
<option></option>
<t t-foreach="col_label.value_ids" t-as="dpv">
<option t-att-value="dpv.id"><t t-esc="dpv.name"/></option>
</t>
</select>
<input t-if="col_label.type == 'checkbox'" type="checkbox" t-att-name="'%s_%s_%s' % (prefix, row_label.id, col_label.id)" t-att-value='col_label.id'/>
</t>
<input t-if="question.matrix_subtype == 'multiple'" type="checkbox" t-att-name="'%s_%s_%s' % (prefix, row_label.id, col_label.id)" t-att-value='col_label.id'/>
</td>
</tr>
</tbody>

2
survey_custom_matrix/views/survey_question.xml

@ -8,7 +8,7 @@
<field name="arch" type="xml">
<xpath expr="//notebook//page//field[@name='labels_ids']//tree" position="inside">
<field name="type"/>
<field name="dpvalues" widget="many2many_tags" attrs="{'invisible': [('type', '!=', 'dropdown')]}"/>
<field name="value_ids" widget="many2many_tags" attrs="{'invisible': [('type', '!=', 'dropdown')]}"/>
</xpath>
</field>
</record>

6
survey_custom_matrix/views/survey_user_input_line.xml

@ -7,11 +7,11 @@
<field name="inherit_id" ref="survey.survey_user_input_line_form"/>
<field name="arch" type="xml">
<field name="value_text" position="after">
<field name="value_dropdown" attrs="{'invisible': [('answer_type','!=','dropdown')]}"/>
<field name="matrix_subtype_id"/>
<field name="value_id" attrs="{'invisible': [('answer_type','!=','dropdown')]}"/>
<field name="matrix_subtype"/>
</field>
<field name="value_suggested" position="replace">
<field name="value_suggested" colspan='2' attrs="{'invisible': [ ('answer_type','!=','suggestion'), ('matrix_subtype_id', '!=', 'custom_row')]}"/>
<field name="value_suggested" colspan='2' attrs="{'invisible': [ ('answer_type','!=','suggestion'), ('matrix_subtype', '!=', 'custom')]}"/>
</field>
</field>
</record>

Loading…
Cancel
Save