Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions survey_contact_generation/models/survey_question.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
class SurveyQuestion(models.Model):
_inherit = "survey.question"

allowed_field_domain = fields.Binary(
compute="_compute_allowed_field_domain",
allowed_partner_field_domain = fields.Binary(
compute="_compute_allowed_partner_field_domain",
)
res_partner_field = fields.Many2one(
string="Contact field",
comodel_name="ir.model.fields",
)

@api.depends("question_type")
def _compute_allowed_field_domain(self):
def _compute_allowed_partner_field_domain(self):
type_mapping = {
"char_box": ["char", "text"],
"text_box": ["html"],
Expand All @@ -33,7 +33,7 @@ def _compute_allowed_field_domain(self):
("store", "=", True),
("readonly", "=", False),
]
record.allowed_field_domain = domain
record.allowed_partner_field_domain = domain


class SurveyQuestionAnswer(models.Model):
Expand Down
4 changes: 2 additions & 2 deletions survey_contact_generation/views/survey_question_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
<field
name="res_partner_field"
options="{'no_create': True, 'no_open': True}"
domain="allowed_field_domain"
domain="allowed_partner_field_domain"
/>
<field name="allowed_field_domain" invisible="1" />
<field name="allowed_partner_field_domain" invisible="1" />
</group>
</xpath>
<xpath expr="//field[@name='suggested_answer_ids']" position="attributes">
Expand Down
8 changes: 4 additions & 4 deletions survey_crm_generation/models/survey_question.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ class SurveyQuestion(models.Model):

show_in_lead_description = fields.Boolean()
# Save into model fields
allowed_field_domain = fields.Binary(
compute="_compute_allowed_field_domain",
allowed_crm_lead_field_domain = fields.Binary(
compute="_compute_allowed_crm_lead_field_domain",
)
crm_lead_field = fields.Many2one(comodel_name="ir.model.fields")

@api.depends("question_type")
def _compute_allowed_field_domain(self):
def _compute_allowed_crm_lead_field_domain(self):
type_mapping = {
"char_box": ["char", "text"],
"text_box": ["html", "text", "char"],
Expand All @@ -32,4 +32,4 @@ def _compute_allowed_field_domain(self):
("store", "=", True),
("readonly", "=", False),
]
record.allowed_field_domain = domain
record.allowed_crm_lead_field_domain = domain
4 changes: 2 additions & 2 deletions survey_crm_generation/views/survey_question_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
name="show_in_lead_description"
invisible="question_type in ['matrix', 'simple_choice', 'multiple_choice']"
/>
<field name="allowed_field_domain" invisible="1" />
<field name="allowed_crm_lead_field_domain" invisible="1" />
<field
name="crm_lead_field"
options="{'no_create': True, 'no_open': True}"
domain="allowed_field_domain"
domain="allowed_crm_lead_field_domain"
/>
</group>
</xpath>
Expand Down