diff --git a/survey_contact_generation/models/survey_question.py b/survey_contact_generation/models/survey_question.py index e86d4a0..577d35b 100644 --- a/survey_contact_generation/models/survey_question.py +++ b/survey_contact_generation/models/survey_question.py @@ -2,6 +2,15 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo import api, fields, models +type_mapping = { + "char_box": ["char", "text"], + "text_box": ["html"], + "numerical_box": ["integer", "float", "html", "char"], + "date": ["date", "text", "char"], + "datetime": ["datetime", "html", "char"], + "simple_choice": ["many2one", "html", "char"], + "multiple_choice": ["many2many", "html", "char"], +} class SurveyQuestion(models.Model): _inherit = "survey.question" @@ -18,15 +27,7 @@ class SurveyQuestion(models.Model): @api.depends("question_type") def _compute_allowed_field_ids(self): - type_mapping = { - "char_box": ["char", "text"], - "text_box": ["html"], - "numerical_box": ["integer", "float", "html", "char"], - "date": ["date", "text", "char"], - "datetime": ["datetime", "html", "char"], - "simple_choice": ["many2one", "html", "char"], - "multiple_choice": ["many2many", "html", "char"], - } + for record in self: record.allowed_field_ids = ( self.env["ir.model.fields"]