[IMP] survey_contact_generation:
* change type mapping to global var
This commit is contained in:
@@ -2,6 +2,15 @@
|
|||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
from odoo import api, fields, models
|
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):
|
class SurveyQuestion(models.Model):
|
||||||
_inherit = "survey.question"
|
_inherit = "survey.question"
|
||||||
@@ -18,15 +27,7 @@ class SurveyQuestion(models.Model):
|
|||||||
|
|
||||||
@api.depends("question_type")
|
@api.depends("question_type")
|
||||||
def _compute_allowed_field_ids(self):
|
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:
|
for record in self:
|
||||||
record.allowed_field_ids = (
|
record.allowed_field_ids = (
|
||||||
self.env["ir.model.fields"]
|
self.env["ir.model.fields"]
|
||||||
|
Reference in New Issue
Block a user