[IMP] survey_crm_generation:
Manage lead description of survey answer with multiple objects
This commit is contained in:
@@ -6,8 +6,8 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Odoo Server 16.0\n"
|
"Project-Id-Version: Odoo Server 16.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2023-09-19 14:35+0000\n"
|
"POT-Creation-Date: 2023-10-24 08:50+0000\n"
|
||||||
"PO-Revision-Date: 2023-09-19 14:35+0000\n"
|
"PO-Revision-Date: 2023-10-24 08:50+0000\n"
|
||||||
"Last-Translator: \n"
|
"Last-Translator: \n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
|
@@ -30,10 +30,28 @@ class SurveyUserInput(models.Model):
|
|||||||
lambda x: not x.skipped and x.question_id.show_in_lead_description
|
lambda x: not x.skipped and x.question_id.show_in_lead_description
|
||||||
)
|
)
|
||||||
|
|
||||||
description = '<u>'+_('Survey answers: ')+"</u><ul><li>"+"</li><li>".join(
|
li = ''
|
||||||
f"{answer.question_id.title}: {answer[f'value_{answer.answer_type}'].display_name}" if isinstance(answer[f'value_{answer.answer_type}'],models.Model) else f"{answer.question_id.title}: {answer[f'value_{answer.answer_type}']}"
|
for answer in relevant_answers:
|
||||||
for answer in relevant_answers
|
li += '<li>'
|
||||||
)+"</li></ul>"
|
answer_value = answer[f'value_{answer.answer_type}']
|
||||||
|
#case of value Models
|
||||||
|
if isinstance(answer_value,models.Model):
|
||||||
|
# case of Multi Models
|
||||||
|
if len(answer_value._ids) > 1:
|
||||||
|
ul2 = f'{answer.question_id.title}: <ul>'
|
||||||
|
for answer_value_object in answer_value:
|
||||||
|
ul2 += '<li>'+f"{answer_value_object.display_name}"+'</li>'
|
||||||
|
ul2 += '</ul>'
|
||||||
|
li += ul2
|
||||||
|
# case of One Models
|
||||||
|
else:
|
||||||
|
li += f"{answer.question_id.title}: {answer_value.display_name}"
|
||||||
|
else:
|
||||||
|
# case of string value
|
||||||
|
li += f"{answer.question_id.title}: {answer_value}"
|
||||||
|
li += '</li>'
|
||||||
|
|
||||||
|
description = '<u>'+_('Survey answers: ')+"</u><ul>"+li+"</ul>"
|
||||||
return description
|
return description
|
||||||
|
|
||||||
def _create_opportunity_post_process(self):
|
def _create_opportunity_post_process(self):
|
||||||
|
Reference in New Issue
Block a user