Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[11.0][MIG] crm_lead_to_event_registration: Migration to 11.0 #117

Merged
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ htmlcov/
nosetests.xml
coverage.xml

# OSX Files
.DS_Store

# Translations
*.mo

Expand Down
70 changes: 70 additions & 0 deletions crm_lead_to_event_registration/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
cristinamartinrod marked this conversation as resolved.
Show resolved Hide resolved
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

====================================
Register a lead directly in an event
====================================

This module allows to register a lead directly in an event when converting
this lead into a partner, so that you can save several steps.

Usage
=====

Go to *Sales > Configuration > Settings* and check "Use leads if you need a
qualification step before creating an opportunity or a customer" option.

Go to any lead in *Sales > Sales > Leads*, and click on the button "Convert
to Opportunity".

In the resulting screen, if the conversion action is "Convert to opportunity"
and you have selected a related partner (a new or an existing one), you will
have a section called "Event registration".

In that section, you can select an event, and when you click on
"Create opportunity", the partner will be registered automatically in the
event.

In any moment, you can also set a registration for an event by clicking on
button "Generate registration", located in tab "Extra info" in marketing
section in any lead or opportunity.

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/199/9.0
cristinamartinrod marked this conversation as resolved.
Show resolved Hide resolved

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/event/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.


Credits
=======

Contributors
------------

* Pedro M. Baeza <pedro.baeza@tecnativa.com>
* Rafael Blasco <rafabn@tecnativa.com>
* Jairo Llopis <jairo.llopis@tecnativa.com>
* Vicent Cubells <vicent.cubells@tecnativa.com>

Maintainer
----------

.. image:: http://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

This module is maintained by the OCA.

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.

To contribute to this module, please visit https://odoo-community.org.
3 changes: 3 additions & 0 deletions crm_lead_to_event_registration/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from . import models, wizard
25 changes: 25 additions & 0 deletions crm_lead_to_event_registration/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2016 Tecnativa - Jairo Llopis
# Copyright 2016 Tecnativa - Pedro M. Baeza
# Copyright 2017 Tecnativa - Vicent Cubells
# Copyright 2018 Tecnativa - Cristina Martin
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

{
"name": "Register a lead directly in an event",
"version": "11.0.1.0.0",
"license": "AGPL-3",
"author": "Tecnativa, "
"Odoo Community Association (OCA)",
"website": "https://github.com/OCA/event",
"category": "Marketing",
"depends": [
'crm',
'event',
],
"data": [
'wizard/crm_lead_event_pick_view.xml',
'wizard/crm_lead_to_opportunity_view.xml',
'views/crm_lead_view.xml',
],
"installable": True,
}
125 changes: 125 additions & 0 deletions crm_lead_to_event_registration/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * crm_lead_to_event_registration
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-02-19 16:38+0100\n"
"PO-Revision-Date: 2016-02-19 16:38+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: 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 1.8.6\n"

#. module: crm_lead_to_event_registration
#: view:crm.lead.event.pick:crm_lead_to_event_registration.event_pick_view
msgid "Accept"
msgstr "Aceptar"

#. module: crm_lead_to_event_registration
#: view:crm.lead.event.pick:crm_lead_to_event_registration.event_pick_view
msgid "Cancel"
msgstr "Cancelar"

#. module: crm_lead_to_event_registration
#: field:crm.lead2opportunity.partner,event_id:0
msgid "Create registration in this event"
msgstr "Crear registro en este evento"

#. module: crm_lead_to_event_registration
#: field:crm.lead.event.pick,create_uid:0
msgid "Created by"
msgstr "Creado por"

#. module: crm_lead_to_event_registration
#: field:crm.lead.event.pick,create_date:0
msgid "Created on"
msgstr "Creado el"

#. module: crm_lead_to_event_registration
#: field:crm.lead.event.pick,event_id:0
msgid "Event"
msgstr "Evento"

#. module: crm_lead_to_event_registration
#: field:crm.lead,event_registration_id:0
#: view:crm.lead2opportunity.partner:crm_lead_to_event_registration.view_crm_lead2opportunity_partner
msgid "Event registration"
msgstr "Registro del evento"

#. module: crm_lead_to_event_registration
#: help:crm.lead.event.pick,event_id:0
msgid "Event where the registration will be created."
msgstr "Evento en que se creará el registro."

#. module: crm_lead_to_event_registration
#: view:crm.lead:crm_lead_to_event_registration.view_crm_lead_form
#: view:crm.lead:crm_lead_to_event_registration.view_crm_opportunity_form
msgid "Generate registration"
msgstr "Generar registro"

#. module: crm_lead_to_event_registration
#: field:crm.lead.event.pick,id:0
msgid "ID"
msgstr "ID"

#. module: crm_lead_to_event_registration
#: field:crm.lead.event.pick,write_uid:0
msgid "Last Updated by"
msgstr "Última actualización por"

#. module: crm_lead_to_event_registration
#: field:crm.lead.event.pick,write_date:0
msgid "Last Updated on"
msgstr "Última actualización en"

#. module: crm_lead_to_event_registration
#: model:ir.model,name:crm_lead_to_event_registration.model_crm_lead2opportunity_partner
msgid "Lead To Opportunity Partner"
msgstr "Iniciativa/Oportunidad a Empresa"

#. module: crm_lead_to_event_registration
#: field:crm.lead.event.pick,lead_id:0
#: model:ir.model,name:crm_lead_to_event_registration.model_crm_lead
msgid "Lead/Opportunity"
msgstr "Iniciativa/Oportunidad"

#. module: crm_lead_to_event_registration
#: help:crm.lead.event.pick,lead_id:0
msgid "Lead/Opportunity from where to get contact information."
msgstr "Iniciativa/Oportunidad de la que extraer la información del contacto."

#. module: crm_lead_to_event_registration
#: model:ir.actions.act_window,name:crm_lead_to_event_registration.event_pick_action
msgid "Pick an event"
msgstr "Escoger un evento"

#. module: crm_lead_to_event_registration
#: help:crm.lead,event_registration_id:0
msgid "Registration generated by this lead/opportunity."
msgstr "Registro generado por esta iniciativa/oportunidad"

#. module: crm_lead_to_event_registration
#: view:crm.lead.event.pick:crm_lead_to_event_registration.event_pick_view
msgid "Select event to register"
msgstr "Seleccione un evento en el que registrar"

#. module: crm_lead_to_event_registration
#: code:addons/crm_lead_to_event_registration/models/crm_lead.py:27
#, python-format
msgid "You must set a name before generating a registration."
msgstr "Debe establecer un nombre antes de generar el registro"

#. module: crm_lead_to_event_registration
#: view:crm.lead.event.pick:crm_lead_to_event_registration.event_pick_view
msgid "or"
msgstr "o"

#~ msgid "You must a name before generating a registration."
#~ msgstr "Debe establecer un nombre antes de generar el registro"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added crm_lead_to_event_registration/images/linked.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added crm_lead_to_event_registration/images/linking.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions crm_lead_to_event_registration/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import crm_lead
56 changes: 56 additions & 0 deletions crm_lead_to_event_registration/models/crm_lead.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Copyright 2016 Tecnativa - Jairo Llopis <jairo.llopis@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import _, api, exceptions, fields, models


class CrmLead(models.Model):
_inherit = "crm.lead"

event_registration_id = fields.Many2one(
comodel_name='event.registration',
string='Event registration',
readonly=True,
help='Registration generated by this lead/opportunity.')

@api.multi
def action_generate_event_registration(self, event):
"""Generate an event registration."""
er = self.env["event.registration"]
for s in self:
name = (s.contact_name or
s.partner_name or
s.partner_id.name)
if not name: # pragma: no cover
raise exceptions.ValidationError(
_("You must set a name before generating a registration."))
s.event_registration_id = er.create({
"event_id": event.id,
"partner_id": s.partner_id.id,
"name": name,
"email": s.email_from,
"phone": s.phone,
})
# Load data from partner if available
s.event_registration_id._onchange_partner()

@api.multi
def action_check_status_confirm_registration(self):
"""If the opportunity is won/lost, open/cancel registration."""
for s in self:
if self._track_subtype(['stage_id']) == "crm.mt_lead_won":
s.event_registration_id.confirm_registration()
elif self._track_subtype(['active']) == "crm.mt_lead_lost":
s.event_registration_id.button_reg_cancel()

@api.model
def create(self, vals):
result = super(CrmLead, self).create(vals)
result.action_check_status_confirm_registration()
return result

@api.multi
def write(self, vals):
result = super(CrmLead, self).write(vals)
self.action_check_status_confirm_registration()
return result
3 changes: 3 additions & 0 deletions crm_lead_to_event_registration/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
To configure this module, you need to:

#. Go to **CRM > Configuration > Settings** and check "Leads. Add a qualification step before creating an opportunity" option.
7 changes: 7 additions & 0 deletions crm_lead_to_event_registration/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
* `Tecnativa <https://www.tecnativa.com>`__:

* Pedro M. Baeza
* Rafael Blasco
* Jairo Llopis
* Vicent Cubells
* Cristina Martín
2 changes: 2 additions & 0 deletions crm_lead_to_event_registration/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module allows to register a lead directly in an event when converting
this lead into a partner, so that you can save several steps.
15 changes: 15 additions & 0 deletions crm_lead_to_event_registration/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#. Go to any lead in **CRM > Pipeline > Leads**

#. Click on the button "Convert to Opportunity".

#. In the resulting screen, if the conversion action is "Convert to opportunity"
and you have selected a related partner (a new or an existing one), you will
have a section called "Event registration".

#. In that section, you can select an event, and when you click on
"Create opportunity", the partner will be registered automatically in the
event.

In any moment, you can also set a registration for an event by clicking on
button "Generate registration", located in tab "Extra info" in marketing
section in any lead or opportunity.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions crm_lead_to_event_registration/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from . import test_crm_lead_to_event_registration
Loading