[ADD] survey_crm_generation
This commit is contained in:
105
survey_crm_generation/README.rst
Normal file
105
survey_crm_generation/README.rst
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
=======================
|
||||||
|
Survey leads generation
|
||||||
|
=======================
|
||||||
|
|
||||||
|
..
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!! This file is generated by oca-gen-addon-readme !!
|
||||||
|
!! changes will be overwritten. !!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!! source digest: sha256:72ceb1068020aaec4baba6df86a6b1b024793db57bdfc2cec8374da9cac8d031
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
||||||
|
:target: https://odoo-community.org/page/development-status
|
||||||
|
:alt: Beta
|
||||||
|
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
|
||||||
|
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||||
|
:alt: License: AGPL-3
|
||||||
|
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsurvey-lightgray.png?logo=github
|
||||||
|
:target: https://github.com/OCA/survey/tree/15.0/survey_crm_generation
|
||||||
|
:alt: OCA/survey
|
||||||
|
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||||
|
:target: https://translation.odoo-community.org/projects/survey-15-0/survey-15-0-survey_crm_generation
|
||||||
|
:alt: Translate me on Weblate
|
||||||
|
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
||||||
|
:target: https://runboat.odoo-community.org/builds?repo=OCA/survey&target_branch=15.0
|
||||||
|
:alt: Try me on Runboat
|
||||||
|
|
||||||
|
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||||
|
|
||||||
|
This module allows to generate leads/opportunities from surveys.
|
||||||
|
|
||||||
|
**Table of contents**
|
||||||
|
|
||||||
|
.. contents::
|
||||||
|
:local:
|
||||||
|
|
||||||
|
Configuration
|
||||||
|
=============
|
||||||
|
|
||||||
|
To configure the leads/opportunities generation:
|
||||||
|
|
||||||
|
#. Go to the configured survey.
|
||||||
|
#. In the *CRM* section of the *Options* tab, set *Generate leads* on.
|
||||||
|
#. Optionally you can set default tags for the generated leads.
|
||||||
|
#. You can set the crm team to assign the leads to.
|
||||||
|
|
||||||
|
The questions marked to be shown in the lead description will be shown there.
|
||||||
|
|
||||||
|
Usage
|
||||||
|
=====
|
||||||
|
|
||||||
|
Once the surveys are submited a lead/opportunity (depending on the default options for
|
||||||
|
the company) will be generated with a link to the answers.
|
||||||
|
|
||||||
|
Bug Tracker
|
||||||
|
===========
|
||||||
|
|
||||||
|
Bugs are tracked on `GitHub Issues <https://github.com/OCA/survey/issues>`_.
|
||||||
|
In case of trouble, please check there if your issue has already been reported.
|
||||||
|
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
||||||
|
`feedback <https://github.com/OCA/survey/issues/new?body=module:%20survey_crm_generation%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||||
|
|
||||||
|
Do not contact contributors directly about support or help with technical issues.
|
||||||
|
|
||||||
|
Credits
|
||||||
|
=======
|
||||||
|
|
||||||
|
Authors
|
||||||
|
~~~~~~~
|
||||||
|
|
||||||
|
* Tecnativa
|
||||||
|
|
||||||
|
Contributors
|
||||||
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
|
* `Tecnativa <https://www.tecnativa.com>`_
|
||||||
|
|
||||||
|
* David Vidal
|
||||||
|
* Stefan ungureanu
|
||||||
|
|
||||||
|
Maintainers
|
||||||
|
~~~~~~~~~~~
|
||||||
|
|
||||||
|
This module is maintained by the OCA.
|
||||||
|
|
||||||
|
.. image:: https://odoo-community.org/logo.png
|
||||||
|
:alt: Odoo Community Association
|
||||||
|
:target: https://odoo-community.org
|
||||||
|
|
||||||
|
OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||||
|
mission is to support the collaborative development of Odoo features and
|
||||||
|
promote its widespread use.
|
||||||
|
|
||||||
|
.. |maintainer-chienandalu| image:: https://github.com/chienandalu.png?size=40px
|
||||||
|
:target: https://github.com/chienandalu
|
||||||
|
:alt: chienandalu
|
||||||
|
|
||||||
|
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|
||||||
|
|
||||||
|
|maintainer-chienandalu|
|
||||||
|
|
||||||
|
This module is part of the `OCA/survey <https://github.com/OCA/survey/tree/15.0/survey_crm_generation>`_ project on GitHub.
|
||||||
|
|
||||||
|
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
1
survey_crm_generation/__init__.py
Normal file
1
survey_crm_generation/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from . import models
|
26
survey_crm_generation/__manifest__.py
Normal file
26
survey_crm_generation/__manifest__.py
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# Copyright 2023 Tecnativa - David Vidal
|
||||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
|
{
|
||||||
|
"name": "Survey leads generation",
|
||||||
|
"summary": "Generate CRM leads/opportunities from surveys",
|
||||||
|
"version": "16.0.1.0.0",
|
||||||
|
"development_status": "Beta",
|
||||||
|
"category": "Marketing/Survey",
|
||||||
|
"website": "https://github.com/OCA/survey",
|
||||||
|
"author": "Tecnativa, Odoo Community Association (OCA)",
|
||||||
|
"maintainers": ["chienandalu"],
|
||||||
|
"license": "AGPL-3",
|
||||||
|
"depends": ["survey", "crm"],
|
||||||
|
"data": [
|
||||||
|
"views/survey_survey_views.xml",
|
||||||
|
"views/survey_question_views.xml",
|
||||||
|
"views/survey_user_input_views.xml",
|
||||||
|
"views/crm_lead_views.xml",
|
||||||
|
],
|
||||||
|
"demo": ["demo/survey_crm_demo.xml"],
|
||||||
|
"assets": {
|
||||||
|
"web.assets_tests": [
|
||||||
|
"/survey_crm_generation/static/tests/survey_crm_generation_tour.js",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
51
survey_crm_generation/demo/survey_crm_demo.xml
Normal file
51
survey_crm_generation/demo/survey_crm_demo.xml
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<odoo>
|
||||||
|
<record model="crm.tag" id="tag_survey_leads">
|
||||||
|
<field name="name">Survey Leads</field>
|
||||||
|
</record>
|
||||||
|
<record model="crm.tag" id="tag_oca_partnership">
|
||||||
|
<field name="name">OCA Partnership</field>
|
||||||
|
</record>
|
||||||
|
<!-- Sales Team -->
|
||||||
|
<record model="crm.team" id="oca_partnership_leads">
|
||||||
|
<field name="name">OCA Partnership</field>
|
||||||
|
</record>
|
||||||
|
<!-- Survey -->
|
||||||
|
<record model="survey.survey" id="become_partner">
|
||||||
|
<field name="title">Become OCA Partner</field>
|
||||||
|
<field name="description">Be part of the Odoo Community!</field>
|
||||||
|
<field name="access_token">08b4db21-66cc-4c69-a712-cc364c54902c</field>
|
||||||
|
<field name="access_mode">public</field>
|
||||||
|
<field name="generate_leads" eval="True" />
|
||||||
|
<field name="crm_team_id" ref="oca_partnership_leads" />
|
||||||
|
<field
|
||||||
|
name="crm_tag_ids"
|
||||||
|
eval="[(6,0,[ref('survey_crm_generation.tag_oca_partnership'), ref('survey_crm_generation.tag_survey_leads')])]"
|
||||||
|
/>
|
||||||
|
<field name="users_can_go_back" eval="True" />
|
||||||
|
</record>
|
||||||
|
<record model="survey.question" id="survey_oca_q0">
|
||||||
|
<field name="survey_id" ref="become_partner" />
|
||||||
|
<field name="sequence">0</field>
|
||||||
|
<field name="title">E-mail address</field>
|
||||||
|
<field name="question_type">text_box</field>
|
||||||
|
<field name="show_in_lead_description" eval="True" />
|
||||||
|
<field name="constr_mandatory" eval="True" />
|
||||||
|
</record>
|
||||||
|
<record model="survey.question" id="survey_oca_q1">
|
||||||
|
<field name="survey_id" ref="become_partner" />
|
||||||
|
<field name="sequence">1</field>
|
||||||
|
<field name="title">Your company name?</field>
|
||||||
|
<field name="question_type">text_box</field>
|
||||||
|
<field name="show_in_lead_description" eval="True" />
|
||||||
|
<field name="constr_mandatory" eval="True" />
|
||||||
|
</record>
|
||||||
|
<record model="survey.question" id="survey_oca_q3">
|
||||||
|
<field name="survey_id" ref="become_partner" />
|
||||||
|
<field name="sequence">2</field>
|
||||||
|
<field name="title">And your name?</field>
|
||||||
|
<field name="question_type">text_box</field>
|
||||||
|
<field name="show_in_lead_description" eval="True" />
|
||||||
|
<field name="constr_mandatory" eval="True" />
|
||||||
|
</record>
|
||||||
|
</odoo>
|
137
survey_crm_generation/i18n/es.po
Normal file
137
survey_crm_generation/i18n/es.po
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
# Translation of Odoo Server.
|
||||||
|
# This file contains the translation of the following modules:
|
||||||
|
# * survey_crm_generation
|
||||||
|
#
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: Odoo Server 15.0\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2023-06-01 09:49+0000\n"
|
||||||
|
"PO-Revision-Date: 2023-06-01 12:07+0200\n"
|
||||||
|
"Last-Translator: \n"
|
||||||
|
"Language-Team: \n"
|
||||||
|
"Language: es_ES\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
"X-Generator: Poedit 3.0.1\n"
|
||||||
|
|
||||||
|
#. module: survey_crm_generation
|
||||||
|
#: model:survey.question,title:survey_crm_generation.survey_oca_q3
|
||||||
|
msgid "And your name?"
|
||||||
|
msgstr "¿Y tu nombre? "
|
||||||
|
|
||||||
|
#. module: survey_crm_generation
|
||||||
|
#: model:survey.survey,description:survey_crm_generation.become_partner
|
||||||
|
msgid "Be part of the Odoo Community!"
|
||||||
|
msgstr "¡Se parte de la comunidad de Odoo!"
|
||||||
|
|
||||||
|
#. module: survey_crm_generation
|
||||||
|
#: model:survey.survey,title:survey_crm_generation.become_partner
|
||||||
|
msgid "Become OCA Partner"
|
||||||
|
msgstr "Conviértete en miembro OCA"
|
||||||
|
|
||||||
|
#. module: survey_crm_generation
|
||||||
|
#: model_terms:ir.ui.view,arch_db:survey_crm_generation.survey_form
|
||||||
|
#: model_terms:ir.ui.view,arch_db:survey_crm_generation.survey_question_form
|
||||||
|
msgid "CRM"
|
||||||
|
msgstr "CRM"
|
||||||
|
|
||||||
|
#. module: survey_crm_generation
|
||||||
|
#: model:ir.model.fields,field_description:survey_crm_generation.field_survey_survey__crm_tag_ids
|
||||||
|
msgid "Crm Tag"
|
||||||
|
msgstr "Etiqueta CRM"
|
||||||
|
|
||||||
|
#. module: survey_crm_generation
|
||||||
|
#: model:ir.model.fields,field_description:survey_crm_generation.field_survey_survey__crm_team_id
|
||||||
|
msgid "Crm Team"
|
||||||
|
msgstr "Equipo CRM"
|
||||||
|
|
||||||
|
#. module: survey_crm_generation
|
||||||
|
#: model:survey.question,title:survey_crm_generation.survey_oca_q0
|
||||||
|
msgid "E-mail address"
|
||||||
|
msgstr "Dirección de correo electrónico"
|
||||||
|
|
||||||
|
#. module: survey_crm_generation
|
||||||
|
#: model:ir.model.fields,field_description:survey_crm_generation.field_survey_survey__generate_leads
|
||||||
|
msgid "Generate Leads"
|
||||||
|
msgstr "Generación de iniciativa"
|
||||||
|
|
||||||
|
#. module: survey_crm_generation
|
||||||
|
#: model:ir.model.fields,help:survey_crm_generation.field_survey_survey__generate_leads
|
||||||
|
msgid "Generate leads/opportunities linked to the generated quotations"
|
||||||
|
msgstr "Generar iniciativas/oportunidades vinculadas a las ofertas generadas"
|
||||||
|
|
||||||
|
#. module: survey_crm_generation
|
||||||
|
#: model:survey.question,comments_message:survey_crm_generation.survey_oca_q0
|
||||||
|
#: model:survey.question,comments_message:survey_crm_generation.survey_oca_q1
|
||||||
|
#: model:survey.question,comments_message:survey_crm_generation.survey_oca_q3
|
||||||
|
msgid "If other, please specify:"
|
||||||
|
msgstr "Si es otro, especifíquelo:"
|
||||||
|
|
||||||
|
#. module: survey_crm_generation
|
||||||
|
#: model:ir.model,name:survey_crm_generation.model_crm_lead
|
||||||
|
msgid "Lead/Opportunity"
|
||||||
|
msgstr "Iniciativa/Oportunidad"
|
||||||
|
|
||||||
|
#. module: survey_crm_generation
|
||||||
|
#: model:crm.tag,name:survey_crm_generation.tag_oca_partnership
|
||||||
|
#: model:crm.team,name:survey_crm_generation.oca_partnership_leads
|
||||||
|
msgid "OCA Partnership"
|
||||||
|
msgstr "Asociación OCA"
|
||||||
|
|
||||||
|
#. module: survey_crm_generation
|
||||||
|
#: model:ir.model.fields,field_description:survey_crm_generation.field_survey_user_input__opportunity_id
|
||||||
|
msgid "Opportunity"
|
||||||
|
msgstr "Oportunidad"
|
||||||
|
|
||||||
|
#. module: survey_crm_generation
|
||||||
|
#: model:ir.model.fields,help:survey_crm_generation.field_survey_survey__crm_tag_ids
|
||||||
|
msgid "Set the default crm tags in the generated leads/opportunities"
|
||||||
|
msgstr "Establecer las etiquetas crm por defecto en las iniciativas/oportunidades generadas"
|
||||||
|
|
||||||
|
#. module: survey_crm_generation
|
||||||
|
#: model:ir.model.fields,field_description:survey_crm_generation.field_survey_question__show_in_lead_description
|
||||||
|
msgid "Show In Lead Description"
|
||||||
|
msgstr "Mostrar en la descripción de la iniciativa"
|
||||||
|
|
||||||
|
#. module: survey_crm_generation
|
||||||
|
#: model:ir.model,name:survey_crm_generation.model_survey_survey
|
||||||
|
msgid "Survey"
|
||||||
|
msgstr "Encuesta"
|
||||||
|
|
||||||
|
#. module: survey_crm_generation
|
||||||
|
#: model:crm.tag,name:survey_crm_generation.tag_survey_leads
|
||||||
|
msgid "Survey Leads"
|
||||||
|
msgstr "Encuesta de la iniciativa"
|
||||||
|
|
||||||
|
#. module: survey_crm_generation
|
||||||
|
#: model:ir.model,name:survey_crm_generation.model_survey_question
|
||||||
|
msgid "Survey Question"
|
||||||
|
msgstr "Pregunta de la encuesta"
|
||||||
|
|
||||||
|
#. module: survey_crm_generation
|
||||||
|
#: model:ir.model,name:survey_crm_generation.model_survey_user_input
|
||||||
|
#: model:ir.model.fields,field_description:survey_crm_generation.field_crm_lead__survey_user_input_id
|
||||||
|
msgid "Survey User Input"
|
||||||
|
msgstr "Respuestas de los usuarios"
|
||||||
|
|
||||||
|
#. module: survey_crm_generation
|
||||||
|
#: model:survey.question,validation_error_msg:survey_crm_generation.survey_oca_q0
|
||||||
|
#: model:survey.question,validation_error_msg:survey_crm_generation.survey_oca_q1
|
||||||
|
#: model:survey.question,validation_error_msg:survey_crm_generation.survey_oca_q3
|
||||||
|
msgid "The answer you entered is not valid."
|
||||||
|
msgstr "La respuesta que has introducido no es válida."
|
||||||
|
|
||||||
|
#. module: survey_crm_generation
|
||||||
|
#: model:survey.question,constr_error_msg:survey_crm_generation.survey_oca_q0
|
||||||
|
#: model:survey.question,constr_error_msg:survey_crm_generation.survey_oca_q1
|
||||||
|
#: model:survey.question,constr_error_msg:survey_crm_generation.survey_oca_q3
|
||||||
|
msgid "This question requires an answer."
|
||||||
|
msgstr "Esta pregunta requiere una respuesta."
|
||||||
|
|
||||||
|
#. module: survey_crm_generation
|
||||||
|
#: model:survey.question,title:survey_crm_generation.survey_oca_q1
|
||||||
|
msgid "Your company name?"
|
||||||
|
msgstr "¿El nombre de su empresa?"
|
4
survey_crm_generation/models/__init__.py
Normal file
4
survey_crm_generation/models/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
from . import crm_lead
|
||||||
|
from . import survey_question
|
||||||
|
from . import survey_survey
|
||||||
|
from . import survey_user_input
|
9
survey_crm_generation/models/crm_lead.py
Normal file
9
survey_crm_generation/models/crm_lead.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# Copyright 2023 Tecnativa - David Vidal
|
||||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
|
from odoo import fields, models
|
||||||
|
|
||||||
|
|
||||||
|
class CrmLead(models.Model):
|
||||||
|
_inherit = "crm.lead"
|
||||||
|
|
||||||
|
survey_user_input_id = fields.Many2one(comodel_name="survey.user_input")
|
9
survey_crm_generation/models/survey_question.py
Normal file
9
survey_crm_generation/models/survey_question.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# Copyright 2022 Tecnativa - David Vidal
|
||||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
|
from odoo import fields, models
|
||||||
|
|
||||||
|
|
||||||
|
class SurveyQuestion(models.Model):
|
||||||
|
_inherit = "survey.question"
|
||||||
|
|
||||||
|
show_in_lead_description = fields.Boolean()
|
16
survey_crm_generation/models/survey_survey.py
Normal file
16
survey_crm_generation/models/survey_survey.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# Copyright 2023 Tecnativa - David Vidal
|
||||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
|
from odoo import fields, models
|
||||||
|
|
||||||
|
|
||||||
|
class SurveySurvey(models.Model):
|
||||||
|
_inherit = "survey.survey"
|
||||||
|
|
||||||
|
generate_leads = fields.Boolean(
|
||||||
|
help="Generate leads/opportunities linked to the generated quotations",
|
||||||
|
)
|
||||||
|
crm_tag_ids = fields.Many2many(
|
||||||
|
comodel_name="crm.tag",
|
||||||
|
help="Set the default crm tags in the generated leads/opportunities",
|
||||||
|
)
|
||||||
|
crm_team_id = fields.Many2one(comodel_name="crm.team")
|
55
survey_crm_generation/models/survey_user_input.py
Normal file
55
survey_crm_generation/models/survey_user_input.py
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
# Copyright 2022 Tecnativa - David Vidal
|
||||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
|
from odoo import fields, models, _
|
||||||
|
|
||||||
|
|
||||||
|
class SurveyUserInput(models.Model):
|
||||||
|
_inherit = "survey.user_input"
|
||||||
|
|
||||||
|
opportunity_id = fields.Many2one(comodel_name="crm.lead")
|
||||||
|
|
||||||
|
def _prepare_opportunity(self):
|
||||||
|
return {
|
||||||
|
"name": self.survey_id.title,
|
||||||
|
"tag_ids": [(6, 0, self.survey_id.crm_tag_ids.ids)],
|
||||||
|
"partner_id": self.partner_id.id,
|
||||||
|
"user_id": self.survey_id.crm_team_id.user_id.id,
|
||||||
|
"team_id": self.survey_id.crm_team_id.id,
|
||||||
|
"company_id": self.create_uid.company_id.id,
|
||||||
|
"survey_user_input_id": self.id,
|
||||||
|
"description": self._prepare_lead_description(),
|
||||||
|
}
|
||||||
|
|
||||||
|
def _prepare_lead_description(self):
|
||||||
|
"""We can have surveys without partner. It's handy to have some relevant info
|
||||||
|
in the description although the answers are linked themselves.
|
||||||
|
|
||||||
|
:return str: description for the lead
|
||||||
|
"""
|
||||||
|
relevant_answers = self.user_input_line_ids.filtered(
|
||||||
|
lambda x: not x.skipped and x.question_id.show_in_lead_description
|
||||||
|
)
|
||||||
|
|
||||||
|
description = '<u>'+_('Survey answers: ')+"</u><ul><li>"+"</li><li>".join(
|
||||||
|
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
|
||||||
|
)+"</li></ul>"
|
||||||
|
return description
|
||||||
|
|
||||||
|
def _create_opportunity_post_process(self):
|
||||||
|
"""After creating the lead send an internal message with the input link"""
|
||||||
|
self.opportunity_id.message_post_with_view(
|
||||||
|
"mail.message_origin_link",
|
||||||
|
values={"self": self.opportunity_id, "origin": self},
|
||||||
|
subtype_id=self.env.ref("mail.mt_note").id,
|
||||||
|
)
|
||||||
|
|
||||||
|
def _mark_done(self):
|
||||||
|
"""Generate the opportunity when the survey is submitted"""
|
||||||
|
res = super()._mark_done()
|
||||||
|
if not self.survey_id.generate_leads:
|
||||||
|
return res
|
||||||
|
vals = self._prepare_opportunity()
|
||||||
|
self.opportunity_id = self.env["crm.lead"].sudo().create(vals)
|
||||||
|
self._create_opportunity_post_process()
|
||||||
|
return res
|
8
survey_crm_generation/readme/CONFIGURE.rst
Normal file
8
survey_crm_generation/readme/CONFIGURE.rst
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
To configure the leads/opportunities generation:
|
||||||
|
|
||||||
|
#. Go to the configured survey.
|
||||||
|
#. In the *CRM* section of the *Options* tab, set *Generate leads* on.
|
||||||
|
#. Optionally you can set default tags for the generated leads.
|
||||||
|
#. You can set the crm team to assign the leads to.
|
||||||
|
|
||||||
|
The questions marked to be shown in the lead description will be shown there.
|
4
survey_crm_generation/readme/CONTRIBUTORS.rst
Normal file
4
survey_crm_generation/readme/CONTRIBUTORS.rst
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
* `Tecnativa <https://www.tecnativa.com>`_
|
||||||
|
|
||||||
|
* David Vidal
|
||||||
|
* Stefan ungureanu
|
1
survey_crm_generation/readme/DESCRIPTION.rst
Normal file
1
survey_crm_generation/readme/DESCRIPTION.rst
Normal file
@@ -0,0 +1 @@
|
|||||||
|
This module allows to generate leads/opportunities from surveys.
|
2
survey_crm_generation/readme/USAGE.rst
Normal file
2
survey_crm_generation/readme/USAGE.rst
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
Once the surveys are submited a lead/opportunity (depending on the default options for
|
||||||
|
the company) will be generated with a link to the answers.
|
BIN
survey_crm_generation/static/description/icon.png
Normal file
BIN
survey_crm_generation/static/description/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.1 KiB |
445
survey_crm_generation/static/description/index.html
Normal file
445
survey_crm_generation/static/description/index.html
Normal file
@@ -0,0 +1,445 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
|
||||||
|
<title>Survey leads generation</title>
|
||||||
|
<style type="text/css">
|
||||||
|
|
||||||
|
/*
|
||||||
|
:Author: David Goodger (goodger@python.org)
|
||||||
|
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
|
||||||
|
:Copyright: This stylesheet has been placed in the public domain.
|
||||||
|
|
||||||
|
Default cascading style sheet for the HTML output of Docutils.
|
||||||
|
|
||||||
|
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
|
||||||
|
customize this style sheet.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* used to remove borders from tables and images */
|
||||||
|
.borderless, table.borderless td, table.borderless th {
|
||||||
|
border: 0 }
|
||||||
|
|
||||||
|
table.borderless td, table.borderless th {
|
||||||
|
/* Override padding for "table.docutils td" with "! important".
|
||||||
|
The right padding separates the table cells. */
|
||||||
|
padding: 0 0.5em 0 0 ! important }
|
||||||
|
|
||||||
|
.first {
|
||||||
|
/* Override more specific margin styles with "! important". */
|
||||||
|
margin-top: 0 ! important }
|
||||||
|
|
||||||
|
.last, .with-subtitle {
|
||||||
|
margin-bottom: 0 ! important }
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none }
|
||||||
|
|
||||||
|
.subscript {
|
||||||
|
vertical-align: sub;
|
||||||
|
font-size: smaller }
|
||||||
|
|
||||||
|
.superscript {
|
||||||
|
vertical-align: super;
|
||||||
|
font-size: smaller }
|
||||||
|
|
||||||
|
a.toc-backref {
|
||||||
|
text-decoration: none ;
|
||||||
|
color: black }
|
||||||
|
|
||||||
|
blockquote.epigraph {
|
||||||
|
margin: 2em 5em ; }
|
||||||
|
|
||||||
|
dl.docutils dd {
|
||||||
|
margin-bottom: 0.5em }
|
||||||
|
|
||||||
|
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Uncomment (and remove this text!) to get bold-faced definition list terms
|
||||||
|
dl.docutils dt {
|
||||||
|
font-weight: bold }
|
||||||
|
*/
|
||||||
|
|
||||||
|
div.abstract {
|
||||||
|
margin: 2em 5em }
|
||||||
|
|
||||||
|
div.abstract p.topic-title {
|
||||||
|
font-weight: bold ;
|
||||||
|
text-align: center }
|
||||||
|
|
||||||
|
div.admonition, div.attention, div.caution, div.danger, div.error,
|
||||||
|
div.hint, div.important, div.note, div.tip, div.warning {
|
||||||
|
margin: 2em ;
|
||||||
|
border: medium outset ;
|
||||||
|
padding: 1em }
|
||||||
|
|
||||||
|
div.admonition p.admonition-title, div.hint p.admonition-title,
|
||||||
|
div.important p.admonition-title, div.note p.admonition-title,
|
||||||
|
div.tip p.admonition-title {
|
||||||
|
font-weight: bold ;
|
||||||
|
font-family: sans-serif }
|
||||||
|
|
||||||
|
div.attention p.admonition-title, div.caution p.admonition-title,
|
||||||
|
div.danger p.admonition-title, div.error p.admonition-title,
|
||||||
|
div.warning p.admonition-title, .code .error {
|
||||||
|
color: red ;
|
||||||
|
font-weight: bold ;
|
||||||
|
font-family: sans-serif }
|
||||||
|
|
||||||
|
/* Uncomment (and remove this text!) to get reduced vertical space in
|
||||||
|
compound paragraphs.
|
||||||
|
div.compound .compound-first, div.compound .compound-middle {
|
||||||
|
margin-bottom: 0.5em }
|
||||||
|
|
||||||
|
div.compound .compound-last, div.compound .compound-middle {
|
||||||
|
margin-top: 0.5em }
|
||||||
|
*/
|
||||||
|
|
||||||
|
div.dedication {
|
||||||
|
margin: 2em 5em ;
|
||||||
|
text-align: center ;
|
||||||
|
font-style: italic }
|
||||||
|
|
||||||
|
div.dedication p.topic-title {
|
||||||
|
font-weight: bold ;
|
||||||
|
font-style: normal }
|
||||||
|
|
||||||
|
div.figure {
|
||||||
|
margin-left: 2em ;
|
||||||
|
margin-right: 2em }
|
||||||
|
|
||||||
|
div.footer, div.header {
|
||||||
|
clear: both;
|
||||||
|
font-size: smaller }
|
||||||
|
|
||||||
|
div.line-block {
|
||||||
|
display: block ;
|
||||||
|
margin-top: 1em ;
|
||||||
|
margin-bottom: 1em }
|
||||||
|
|
||||||
|
div.line-block div.line-block {
|
||||||
|
margin-top: 0 ;
|
||||||
|
margin-bottom: 0 ;
|
||||||
|
margin-left: 1.5em }
|
||||||
|
|
||||||
|
div.sidebar {
|
||||||
|
margin: 0 0 0.5em 1em ;
|
||||||
|
border: medium outset ;
|
||||||
|
padding: 1em ;
|
||||||
|
background-color: #ffffee ;
|
||||||
|
width: 40% ;
|
||||||
|
float: right ;
|
||||||
|
clear: right }
|
||||||
|
|
||||||
|
div.sidebar p.rubric {
|
||||||
|
font-family: sans-serif ;
|
||||||
|
font-size: medium }
|
||||||
|
|
||||||
|
div.system-messages {
|
||||||
|
margin: 5em }
|
||||||
|
|
||||||
|
div.system-messages h1 {
|
||||||
|
color: red }
|
||||||
|
|
||||||
|
div.system-message {
|
||||||
|
border: medium outset ;
|
||||||
|
padding: 1em }
|
||||||
|
|
||||||
|
div.system-message p.system-message-title {
|
||||||
|
color: red ;
|
||||||
|
font-weight: bold }
|
||||||
|
|
||||||
|
div.topic {
|
||||||
|
margin: 2em }
|
||||||
|
|
||||||
|
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
|
||||||
|
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
|
||||||
|
margin-top: 0.4em }
|
||||||
|
|
||||||
|
h1.title {
|
||||||
|
text-align: center }
|
||||||
|
|
||||||
|
h2.subtitle {
|
||||||
|
text-align: center }
|
||||||
|
|
||||||
|
hr.docutils {
|
||||||
|
width: 75% }
|
||||||
|
|
||||||
|
img.align-left, .figure.align-left, object.align-left, table.align-left {
|
||||||
|
clear: left ;
|
||||||
|
float: left ;
|
||||||
|
margin-right: 1em }
|
||||||
|
|
||||||
|
img.align-right, .figure.align-right, object.align-right, table.align-right {
|
||||||
|
clear: right ;
|
||||||
|
float: right ;
|
||||||
|
margin-left: 1em }
|
||||||
|
|
||||||
|
img.align-center, .figure.align-center, object.align-center {
|
||||||
|
display: block;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.align-center {
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.align-left {
|
||||||
|
text-align: left }
|
||||||
|
|
||||||
|
.align-center {
|
||||||
|
clear: both ;
|
||||||
|
text-align: center }
|
||||||
|
|
||||||
|
.align-right {
|
||||||
|
text-align: right }
|
||||||
|
|
||||||
|
/* reset inner alignment in figures */
|
||||||
|
div.align-right {
|
||||||
|
text-align: inherit }
|
||||||
|
|
||||||
|
/* div.align-center * { */
|
||||||
|
/* text-align: left } */
|
||||||
|
|
||||||
|
.align-top {
|
||||||
|
vertical-align: top }
|
||||||
|
|
||||||
|
.align-middle {
|
||||||
|
vertical-align: middle }
|
||||||
|
|
||||||
|
.align-bottom {
|
||||||
|
vertical-align: bottom }
|
||||||
|
|
||||||
|
ol.simple, ul.simple {
|
||||||
|
margin-bottom: 1em }
|
||||||
|
|
||||||
|
ol.arabic {
|
||||||
|
list-style: decimal }
|
||||||
|
|
||||||
|
ol.loweralpha {
|
||||||
|
list-style: lower-alpha }
|
||||||
|
|
||||||
|
ol.upperalpha {
|
||||||
|
list-style: upper-alpha }
|
||||||
|
|
||||||
|
ol.lowerroman {
|
||||||
|
list-style: lower-roman }
|
||||||
|
|
||||||
|
ol.upperroman {
|
||||||
|
list-style: upper-roman }
|
||||||
|
|
||||||
|
p.attribution {
|
||||||
|
text-align: right ;
|
||||||
|
margin-left: 50% }
|
||||||
|
|
||||||
|
p.caption {
|
||||||
|
font-style: italic }
|
||||||
|
|
||||||
|
p.credits {
|
||||||
|
font-style: italic ;
|
||||||
|
font-size: smaller }
|
||||||
|
|
||||||
|
p.label {
|
||||||
|
white-space: nowrap }
|
||||||
|
|
||||||
|
p.rubric {
|
||||||
|
font-weight: bold ;
|
||||||
|
font-size: larger ;
|
||||||
|
color: maroon ;
|
||||||
|
text-align: center }
|
||||||
|
|
||||||
|
p.sidebar-title {
|
||||||
|
font-family: sans-serif ;
|
||||||
|
font-weight: bold ;
|
||||||
|
font-size: larger }
|
||||||
|
|
||||||
|
p.sidebar-subtitle {
|
||||||
|
font-family: sans-serif ;
|
||||||
|
font-weight: bold }
|
||||||
|
|
||||||
|
p.topic-title {
|
||||||
|
font-weight: bold }
|
||||||
|
|
||||||
|
pre.address {
|
||||||
|
margin-bottom: 0 ;
|
||||||
|
margin-top: 0 ;
|
||||||
|
font: inherit }
|
||||||
|
|
||||||
|
pre.literal-block, pre.doctest-block, pre.math, pre.code {
|
||||||
|
margin-left: 2em ;
|
||||||
|
margin-right: 2em }
|
||||||
|
|
||||||
|
pre.code .ln { color: grey; } /* line numbers */
|
||||||
|
pre.code, code { background-color: #eeeeee }
|
||||||
|
pre.code .comment, code .comment { color: #5C6576 }
|
||||||
|
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
|
||||||
|
pre.code .literal.string, code .literal.string { color: #0C5404 }
|
||||||
|
pre.code .name.builtin, code .name.builtin { color: #352B84 }
|
||||||
|
pre.code .deleted, code .deleted { background-color: #DEB0A1}
|
||||||
|
pre.code .inserted, code .inserted { background-color: #A3D289}
|
||||||
|
|
||||||
|
span.classifier {
|
||||||
|
font-family: sans-serif ;
|
||||||
|
font-style: oblique }
|
||||||
|
|
||||||
|
span.classifier-delimiter {
|
||||||
|
font-family: sans-serif ;
|
||||||
|
font-weight: bold }
|
||||||
|
|
||||||
|
span.interpreted {
|
||||||
|
font-family: sans-serif }
|
||||||
|
|
||||||
|
span.option {
|
||||||
|
white-space: nowrap }
|
||||||
|
|
||||||
|
span.pre {
|
||||||
|
white-space: pre }
|
||||||
|
|
||||||
|
span.problematic {
|
||||||
|
color: red }
|
||||||
|
|
||||||
|
span.section-subtitle {
|
||||||
|
/* font-size relative to parent (h1..h6 element) */
|
||||||
|
font-size: 80% }
|
||||||
|
|
||||||
|
table.citation {
|
||||||
|
border-left: solid 1px gray;
|
||||||
|
margin-left: 1px }
|
||||||
|
|
||||||
|
table.docinfo {
|
||||||
|
margin: 2em 4em }
|
||||||
|
|
||||||
|
table.docutils {
|
||||||
|
margin-top: 0.5em ;
|
||||||
|
margin-bottom: 0.5em }
|
||||||
|
|
||||||
|
table.footnote {
|
||||||
|
border-left: solid 1px black;
|
||||||
|
margin-left: 1px }
|
||||||
|
|
||||||
|
table.docutils td, table.docutils th,
|
||||||
|
table.docinfo td, table.docinfo th {
|
||||||
|
padding-left: 0.5em ;
|
||||||
|
padding-right: 0.5em ;
|
||||||
|
vertical-align: top }
|
||||||
|
|
||||||
|
table.docutils th.field-name, table.docinfo th.docinfo-name {
|
||||||
|
font-weight: bold ;
|
||||||
|
text-align: left ;
|
||||||
|
white-space: nowrap ;
|
||||||
|
padding-left: 0 }
|
||||||
|
|
||||||
|
/* "booktabs" style (no vertical lines) */
|
||||||
|
table.docutils.booktabs {
|
||||||
|
border: 0px;
|
||||||
|
border-top: 2px solid;
|
||||||
|
border-bottom: 2px solid;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
table.docutils.booktabs * {
|
||||||
|
border: 0px;
|
||||||
|
}
|
||||||
|
table.docutils.booktabs th {
|
||||||
|
border-bottom: thin solid;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
|
||||||
|
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
|
||||||
|
font-size: 100% }
|
||||||
|
|
||||||
|
ul.auto-toc {
|
||||||
|
list-style-type: none }
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="document" id="survey-leads-generation">
|
||||||
|
<h1 class="title">Survey leads generation</h1>
|
||||||
|
|
||||||
|
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!! This file is generated by oca-gen-addon-readme !!
|
||||||
|
!! changes will be overwritten. !!
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
!! source digest: sha256:72ceb1068020aaec4baba6df86a6b1b024793db57bdfc2cec8374da9cac8d031
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||||
|
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/survey/tree/15.0/survey_crm_generation"><img alt="OCA/survey" src="https://img.shields.io/badge/github-OCA%2Fsurvey-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/survey-15-0/survey-15-0-survey_crm_generation"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/survey&target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||||
|
<p>This module allows to generate leads/opportunities from surveys.</p>
|
||||||
|
<p><strong>Table of contents</strong></p>
|
||||||
|
<div class="contents local topic" id="contents">
|
||||||
|
<ul class="simple">
|
||||||
|
<li><a class="reference internal" href="#configuration" id="toc-entry-1">Configuration</a></li>
|
||||||
|
<li><a class="reference internal" href="#usage" id="toc-entry-2">Usage</a></li>
|
||||||
|
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
|
||||||
|
<li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
|
||||||
|
<li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
|
||||||
|
<li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
|
||||||
|
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="configuration">
|
||||||
|
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
|
||||||
|
<p>To configure the leads/opportunities generation:</p>
|
||||||
|
<ol class="arabic simple">
|
||||||
|
<li>Go to the configured survey.</li>
|
||||||
|
<li>In the <em>CRM</em> section of the <em>Options</em> tab, set <em>Generate leads</em> on.</li>
|
||||||
|
<li>Optionally you can set default tags for the generated leads.</li>
|
||||||
|
<li>You can set the crm team to assign the leads to.</li>
|
||||||
|
</ol>
|
||||||
|
<p>The questions marked to be shown in the lead description will be shown there.</p>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="usage">
|
||||||
|
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
|
||||||
|
<p>Once the surveys are submited a lead/opportunity (depending on the default options for
|
||||||
|
the company) will be generated with a link to the answers.</p>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="bug-tracker">
|
||||||
|
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
|
||||||
|
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/survey/issues">GitHub Issues</a>.
|
||||||
|
In case of trouble, please check there if your issue has already been reported.
|
||||||
|
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
||||||
|
<a class="reference external" href="https://github.com/OCA/survey/issues/new?body=module:%20survey_crm_generation%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||||
|
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="credits">
|
||||||
|
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
|
||||||
|
<div class="section" id="authors">
|
||||||
|
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
|
||||||
|
<ul class="simple">
|
||||||
|
<li>Tecnativa</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="contributors">
|
||||||
|
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
|
||||||
|
<ul class="simple">
|
||||||
|
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a><ul>
|
||||||
|
<li>David Vidal</li>
|
||||||
|
<li>Stefan ungureanu</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="maintainers">
|
||||||
|
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
|
||||||
|
<p>This module is maintained by the OCA.</p>
|
||||||
|
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
|
||||||
|
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||||
|
mission is to support the collaborative development of Odoo features and
|
||||||
|
promote its widespread use.</p>
|
||||||
|
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
|
||||||
|
<p><a class="reference external image-reference" href="https://github.com/chienandalu"><img alt="chienandalu" src="https://github.com/chienandalu.png?size=40px" /></a></p>
|
||||||
|
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/survey/tree/15.0/survey_crm_generation">OCA/survey</a> project on GitHub.</p>
|
||||||
|
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@@ -0,0 +1,48 @@
|
|||||||
|
odoo.define(
|
||||||
|
"survey_crm_generation.tour_test_survey_crm_generation",
|
||||||
|
function (require) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const tour = require("web_tour.tour");
|
||||||
|
|
||||||
|
tour.register(
|
||||||
|
"test_survey_crm_generation",
|
||||||
|
{
|
||||||
|
test: true,
|
||||||
|
url: "/survey/start/08b4db21-66cc-4c69-a712-cc364c54902c",
|
||||||
|
},
|
||||||
|
[
|
||||||
|
{
|
||||||
|
content: "Start Survey",
|
||||||
|
trigger: "button.btn:contains('Start Survey')",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
content: "E-mail address",
|
||||||
|
trigger:
|
||||||
|
"div.js_question-wrapper:contains('E-mail address') textarea",
|
||||||
|
run: "text test@test.com",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
content: "Your company name?",
|
||||||
|
trigger:
|
||||||
|
"div.js_question-wrapper:contains('Your company name?') textarea",
|
||||||
|
run: "text Tecnativa",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
content: "And your name?",
|
||||||
|
trigger:
|
||||||
|
"div.js_question-wrapper:contains('And your name?') textarea",
|
||||||
|
run: "text Tecnativa",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
content: "Click Submit",
|
||||||
|
trigger: "button[value='finish']",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
content: "Thank you",
|
||||||
|
trigger: "h1:contains('Thank you!')",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
1
survey_crm_generation/tests/__init__.py
Normal file
1
survey_crm_generation/tests/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from . import test_survey_crm_sale_generation
|
@@ -0,0 +1,49 @@
|
|||||||
|
# Copyright 2023 Tecnativa - David Vidal
|
||||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
|
from markupsafe import Markup
|
||||||
|
|
||||||
|
from odoo.tests import HttpCase, tagged
|
||||||
|
|
||||||
|
from odoo.addons.survey.tests.common import SurveyCase
|
||||||
|
|
||||||
|
|
||||||
|
@tagged("-at_install", "post_install")
|
||||||
|
class SurveyCrmGenerationCase(SurveyCase, HttpCase):
|
||||||
|
def setUp(self):
|
||||||
|
"""We run the tour in the setup so we can share the tests case with other
|
||||||
|
modules"""
|
||||||
|
super().setUp()
|
||||||
|
self.oca_leads = self.env.ref("survey_crm_generation.oca_partnership_leads")
|
||||||
|
self.survey = self.env.ref("survey_crm_generation.become_partner")
|
||||||
|
initial_user_inputs = self.survey.user_input_ids
|
||||||
|
# Run the survey as a portal user and get the generated quotation
|
||||||
|
self.start_tour(
|
||||||
|
f"/survey/start/{self.survey.access_token}",
|
||||||
|
"test_survey_crm_generation",
|
||||||
|
login="portal",
|
||||||
|
)
|
||||||
|
self.user_input = self.survey.user_input_ids - initial_user_inputs
|
||||||
|
self.generated_lead = self.user_input.opportunity_id
|
||||||
|
|
||||||
|
|
||||||
|
@tagged("-at_install", "post_install")
|
||||||
|
class SurveyCrmGenerationTests(SurveyCrmGenerationCase):
|
||||||
|
def test_lead_generation(self):
|
||||||
|
self.assertFalse(self.generated_lead.stage_id.is_won)
|
||||||
|
self.assertEqual(self.generated_lead.team_id, self.oca_leads)
|
||||||
|
self.assertEqual(
|
||||||
|
self.generated_lead.tag_ids,
|
||||||
|
(
|
||||||
|
self.env.ref("survey_crm_generation.tag_oca_partnership")
|
||||||
|
+ self.env.ref("survey_crm_generation.tag_survey_leads")
|
||||||
|
),
|
||||||
|
)
|
||||||
|
expected_lead_description = Markup(
|
||||||
|
"<p>E-mail address: test@test.com\n"
|
||||||
|
"Your company name?: Tecnativa\n"
|
||||||
|
"And your name?: Tecnativa</p>"
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
self.generated_lead.description,
|
||||||
|
expected_lead_description,
|
||||||
|
)
|
15
survey_crm_generation/views/crm_lead_views.xml
Normal file
15
survey_crm_generation/views/crm_lead_views.xml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<odoo>
|
||||||
|
<record id="crm_lead_view_form" model="ir.ui.view">
|
||||||
|
<field name="model">crm.lead</field>
|
||||||
|
<field name="inherit_id" ref="crm.crm_lead_view_form" />
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="team_id" position="after">
|
||||||
|
<field
|
||||||
|
name="survey_user_input_id"
|
||||||
|
attrs="{'invisible': [('survey_user_input_id', '=', False)]}"
|
||||||
|
/>
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
17
survey_crm_generation/views/survey_question_views.xml
Normal file
17
survey_crm_generation/views/survey_question_views.xml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<odoo>
|
||||||
|
<record id="survey_question_form" model="ir.ui.view">
|
||||||
|
<field name="model">survey.question</field>
|
||||||
|
<field name="inherit_id" ref="survey.survey_question_form" />
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//field[@name='comments_allowed']/.." position="after">
|
||||||
|
<group name="crm" string="CRM">
|
||||||
|
<field
|
||||||
|
name="show_in_lead_description"
|
||||||
|
attrs="{'invisible': [('question_type', 'in', ['matrix', 'simple_choice', 'multiple_choice'])]}"
|
||||||
|
/>
|
||||||
|
</group>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
23
survey_crm_generation/views/survey_survey_views.xml
Normal file
23
survey_crm_generation/views/survey_survey_views.xml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<odoo>
|
||||||
|
<record id="survey_form" model="ir.ui.view">
|
||||||
|
<field name="model">survey.survey</field>
|
||||||
|
<field name="inherit_id" ref="survey.survey_survey_view_form" />
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<group name="options" position="inside">
|
||||||
|
<group name="crm_options" string="CRM">
|
||||||
|
<field name="generate_leads" />
|
||||||
|
<field
|
||||||
|
name="crm_team_id"
|
||||||
|
attrs="{'invisible': [('generate_leads', '=', False)]}"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
name="crm_tag_ids"
|
||||||
|
widget="many2many_tags"
|
||||||
|
attrs="{'invisible': [('generate_leads', '=', False)]}"
|
||||||
|
/>
|
||||||
|
</group>
|
||||||
|
</group>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
15
survey_crm_generation/views/survey_user_input_views.xml
Normal file
15
survey_crm_generation/views/survey_user_input_views.xml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<odoo>
|
||||||
|
<record model="ir.ui.view" id="survey_user_input_view_form">
|
||||||
|
<field name="model">survey.user_input</field>
|
||||||
|
<field name="inherit_id" ref="survey.survey_user_input_view_form" />
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="partner_id" position="before">
|
||||||
|
<field
|
||||||
|
name="opportunity_id"
|
||||||
|
attrs="{'invisible': [('opportunity_id', '=', False)]}"
|
||||||
|
/>
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
Reference in New Issue
Block a user