[ADD] website_event_crm_questions: create leads from attendees

PURPOSE

Introduce an automated tool to create leads from event registrations. Events
are a powerful source of leads as they attract attention. This leads to leads
with good quality as they mark interest while gathering contact information
which allows to follow-up.

This merge aims at automating this process by automatically creating leads
based on user-defined rules.

SPECIFICATIONS

Include in generated lead description answers from attendees to questions
defined using the website_event_questions module.

LINKS

Task ID 2166679
PR #52334
Upgrade PR odoo/upgrade#1292

Co-Authored-By: Jérémy Hennecart <jeh@odoo.com>
Co-Authored-By: Thibault Delavallée <tde@odoo.com>
This commit is contained in:
Jérémy Hennecart
2020-06-10 16:10:28 +00:00
committed by Thibault Delavallée
co-authored by Thibault Delavallée
parent d8b5d1a0c5
commit da1adb439e
4 changed files with 51 additions and 0 deletions
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import models
@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Webiste Event CRM Questions',
'version': '1.0',
'category': 'Marketing/Events',
'website': 'https://www.odoo.com/page/events',
'description': """
Add information when we build the description of a lead to include
the questions and answers linked to the registrations.
""",
'depends': ['website_event_crm', 'website_event_questions'],
'data': [],
'installable': True,
'auto_install': True,
}
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import event_registration
@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, _
class EventRegistration(models.Model):
_inherit = 'event.registration'
def _get_lead_description_registration(self, prefix='', line_suffix=''):
"""Add the questions and answers linked to the registrations into the description of the lead."""
reg_description = super(EventRegistration, self)._get_lead_description_registration(prefix=prefix, line_suffix=line_suffix)
if not self.registration_answer_ids:
return reg_description
answer_descriptions = []
for answer in self.registration_answer_ids:
answer_value = answer.value_answer_id.name if answer.question_type == "simple_choice" else answer.value_text_box
answer_value = "\n".join([" %s" % line for line in answer_value.split('\n')])
answer_descriptions.append(" - %s\n%s" % (answer.question_id.title, answer_value))
return "%s\n%s\n%s" % (reg_description, _("Questions"), '\n'.join(answer_descriptions))
def _get_lead_description_fields(self):
res = super(EventRegistration, self)._get_lead_description_fields()
res.append('registration_answer_ids')
return res