[IMP] survey_contact_generation:

* change type mapping to global var
This commit is contained in:
clementthomas
2023-11-21 13:47:34 +01:00
parent 61e01e4be0
commit 9446bf2c2d

View File

@@ -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"]