-
-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from pedrobaeza/8.0-event_registration_cancel_…
…reason [ADD] event_registration_cancel_reason
- Loading branch information
Showing
14 changed files
with
460 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
=========================================== | ||
Reasons for event registration cancellation | ||
=========================================== | ||
|
||
This module allows to add predefined reasons for the attendees to report back | ||
why they cancel their registration to an event. | ||
|
||
Configuration | ||
============= | ||
|
||
Go to *Marketing > Configuration > Events > Registrations cancellation reasons* for | ||
setting the possible reasons you want to handle. You can also set if a reason | ||
is only available for certain types of events or, if you leave it empty, for | ||
all. | ||
|
||
Usage | ||
===== | ||
|
||
Go to *Marketing > Events > Events*, enter into the details of any of the | ||
events, and press the red circle button in the right part of any of the | ||
registrations. A new screen will appear asking you to enter the reason why the | ||
registration is cancelled. | ||
|
||
You will get also the same screen when pressing the button | ||
*Cancel registration* from the details view of a registration in | ||
*Marketing > Events > Registrations*. On this object, you can group by the | ||
cancellation reason in the list, calendar or graph view. | ||
|
||
.. 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/8.0 | ||
|
||
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 | ||
<https://github.com/OCA/ | ||
event/issues/new?body=module:%20 | ||
event_registration_cancel_reason%0Aversion:%20 | ||
8.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Pedro M. Baeza <pedro.baeza@serviciosbaeza.com> | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: https://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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 Antiun Ingeniería S.L. | ||
# © 2016 Pedro M. Baeza <pedro.baeza@serviciosbaeza.com> | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
from . import models | ||
from . import wizard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 Antiun Ingeniería S.L. | ||
# © 2016 Pedro M. Baeza <pedro.baeza@serviciosbaeza.com> | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
{ | ||
"name": "Reasons for event registrations cancellations", | ||
"version": "8.0.1.0.0", | ||
"license": "AGPL-3", | ||
"author": "Antiun Ingeniería S.L., " | ||
"Serv. Tecnol. Avanzados - Pedro M. Baeza, " | ||
"Odoo Community Association (OCA)", | ||
"website": "https://www.antiun.com", | ||
"category": "Event Management", | ||
"depends": [ | ||
'event', | ||
], | ||
"data": [ | ||
'security/ir.model.access.csv', | ||
'views/event_registration_view.xml', | ||
'wizard/event_registration_cancel_log_reason_view.xml', | ||
], | ||
"installable": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | ||
# * event_registration_cancel_reason | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 8.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2016-02-15 16:33+0100\n" | ||
"PO-Revision-Date: 2016-02-15 16:34+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: \n" | ||
"X-Generator: Poedit 1.8.6\n" | ||
|
||
#. module: event_registration_cancel_reason | ||
#: view:event.registration.cancel.log.reason:event_registration_cancel_reason.event_registration_cancel_log_reason_view | ||
msgid "Abort" | ||
msgstr "Abortar" | ||
|
||
#. module: event_registration_cancel_reason | ||
#: view:event.registration.cancel.log.reason:event_registration_cancel_reason.event_registration_cancel_log_reason_view | ||
msgid "Cancel registration" | ||
msgstr "Cancelar registro" | ||
|
||
#. module: event_registration_cancel_reason | ||
#: view:event.registration:event_registration_cancel_reason.view_event_registration_form | ||
msgid "Cancellation Reason:" | ||
msgstr "Razón de cancelación:" | ||
|
||
#. module: event_registration_cancel_reason | ||
#: view:event.registration:event_registration_cancel_reason.view_registration_search | ||
#: field:event.registration,cancel_reason_id:0 | ||
msgid "Cancellation reason" | ||
msgstr "Razón de cancelación" | ||
|
||
#. module: event_registration_cancel_reason | ||
#: field:event.registration.cancel.log.reason,create_uid:0 | ||
#: field:event.registration.cancel.reason,create_uid:0 | ||
msgid "Created by" | ||
msgstr "Creado por" | ||
|
||
#. module: event_registration_cancel_reason | ||
#: field:event.registration.cancel.log.reason,create_date:0 | ||
#: field:event.registration.cancel.reason,create_date:0 | ||
msgid "Created on" | ||
msgstr "Creado en" | ||
|
||
#. module: event_registration_cancel_reason | ||
#: model:ir.model,name:event_registration_cancel_reason.model_event_registration | ||
msgid "Event Registration" | ||
msgstr "Registro evento" | ||
|
||
#. module: event_registration_cancel_reason | ||
#: field:event.registration.cancel.log.reason,event_type_id:0 | ||
msgid "Event type" | ||
msgstr "Tipo de evento" | ||
|
||
#. module: event_registration_cancel_reason | ||
#: field:event.registration.cancel.reason,event_type_ids:0 | ||
msgid "Event types" | ||
msgstr "Tipos de evento" | ||
|
||
#. module: event_registration_cancel_reason | ||
#: field:event.registration.cancel.log.reason,id:0 | ||
#: field:event.registration.cancel.reason,id:0 | ||
msgid "ID" | ||
msgstr "ID" | ||
|
||
#. module: event_registration_cancel_reason | ||
#: field:event.registration.cancel.log.reason,write_uid:0 | ||
#: field:event.registration.cancel.reason,write_uid:0 | ||
msgid "Last Updated by" | ||
msgstr "Última actualización por" | ||
|
||
#. module: event_registration_cancel_reason | ||
#: field:event.registration.cancel.log.reason,write_date:0 | ||
#: field:event.registration.cancel.reason,write_date:0 | ||
msgid "Last Updated on" | ||
msgstr "Última actualización en" | ||
|
||
#. module: event_registration_cancel_reason | ||
#: field:event.registration.cancel.reason,name:0 | ||
msgid "Reason" | ||
msgstr "Razón" | ||
|
||
#. module: event_registration_cancel_reason | ||
#: field:event.registration.cancel.log.reason,reason_id:0 | ||
msgid "Reason id" | ||
msgstr "Razón" | ||
|
||
#. module: event_registration_cancel_reason | ||
#: model:ir.actions.act_window,name:event_registration_cancel_reason.event_registration_cancel_reason_action | ||
#: model:ir.ui.menu,name:event_registration_cancel_reason.menu_event_registration_cancel_reason | ||
msgid "Registration cancellation reasons" | ||
msgstr "Razones de cancelación de registros" | ||
|
||
#. module: event_registration_cancel_reason | ||
#: help:event.registration.cancel.reason,event_type_ids:0 | ||
msgid "" | ||
"Select the event types where you want to use this cancellation reason. Leave " | ||
"it empty for using in all." | ||
msgstr "" | ||
"Seleccione los tipos de evento en los que quiere usar esta razón de " | ||
"cancelación. Déjelo en blanco para usarla en todos." | ||
|
||
#. module: event_registration_cancel_reason | ||
#: view:event.registration.cancel.log.reason:event_registration_cancel_reason.event_registration_cancel_log_reason_view | ||
msgid "Select the reason for cancelling the registration:" | ||
msgstr "Seleccione la razón para cancelar el registro:" | ||
|
||
#. module: event_registration_cancel_reason | ||
#: code:addons/event_registration_cancel_reason/wizard/event_registration_cancel_log_reason.py:31 | ||
#, python-format | ||
msgid "You cannot cancel registrations from events of different types at once." | ||
msgstr "No puede cancelar registros de eventos de distintos tipos a la vez." | ||
|
||
#. module: event_registration_cancel_reason | ||
#: view:event.registration.cancel.log.reason:event_registration_cancel_reason.event_registration_cancel_log_reason_view | ||
msgid "or" | ||
msgstr "o" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 Antiun Ingeniería S.L. | ||
# © 2016 Pedro M. Baeza <pedro.baeza@serviciosbaeza.com> | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
from . import event_registration |
42 changes: 42 additions & 0 deletions
42
event_registration_cancel_reason/models/event_registration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 Antiun Ingeniería S.L. | ||
# © 2016 Pedro M. Baeza <pedro.baeza@serviciosbaeza.com> | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
from openerp import api, fields, models | ||
|
||
|
||
class EventRegistration(models.Model): | ||
_inherit = 'event.registration' | ||
|
||
cancel_reason_id = fields.Many2one( | ||
comodel_name='event.registration.cancel.reason', readonly=True, | ||
string="Cancellation reason", ondelete="restrict") | ||
|
||
@api.multi | ||
def button_reg_cancel(self): | ||
if self.env.context.get('bypass_reason'): | ||
return super(EventRegistration, self).button_reg_cancel() | ||
return { | ||
'type': 'ir.actions.act_window', | ||
'name': 'Cancellation reason', | ||
'res_model': 'event.registration.cancel.log.reason', | ||
'view_type': 'form', | ||
'view_mode': 'form', | ||
'target': 'new', | ||
} | ||
|
||
@api.multi | ||
def do_draft(self): | ||
super(EventRegistration, self).do_draft() | ||
self.write({'cancel_reason_id': False}) | ||
|
||
|
||
class EventRegistrationCancelReason(models.Model): | ||
_name = 'event.registration.cancel.reason' | ||
|
||
name = fields.Char('Reason', required=True, translate=True) | ||
event_type_ids = fields.Many2many( | ||
comodel_name="event.type", string="Event types", | ||
help="Select the event types where you want to use this cancellation " | ||
"reason. Leave it empty for using in all.") |
2 changes: 2 additions & 0 deletions
2
event_registration_cancel_reason/security/ir.model.access.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_event_registration_cancel_reason,event.registration.cancel.reason,model_event_registration_cancel_reason,event.group_event_user,1,1,1,1 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 Antiun Ingeniería S.L. | ||
# © 2016 Pedro M. Baeza <pedro.baeza@serviciosbaeza.com> | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
from . import test_event_registration_cancel_reason |
46 changes: 46 additions & 0 deletions
46
event_registration_cancel_reason/tests/test_event_registration_cancel_reason.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 Antiun Ingeniería S.L. | ||
# © 2016 Pedro M. Baeza <pedro.baeza@serviciosbaeza.com> | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
from openerp import exceptions, fields | ||
from openerp.tests import common | ||
|
||
|
||
class TestEventRegistrationCancelReason(common.TransactionCase): | ||
def setUp(self): | ||
super(TestEventRegistrationCancelReason, self).setUp() | ||
self.event1 = self.env['event.event'].create( | ||
{'name': 'Test event', | ||
'type': self.env.ref('event.event_type_1').id, | ||
'date_begin': fields.Date.today(), | ||
'date_end': fields.Date.today()}) | ||
self.event2 = self.event1.copy() | ||
self.partner = self.env['res.partner'].create({'name': 'Test partner'}) | ||
self.cancel_reason = self.env[ | ||
'event.registration.cancel.reason'].create({'name': 'Test reason'}) | ||
self.registration1 = self.env['event.registration'].create( | ||
{'event_id': self.event1.id, | ||
'partner_id': self.partner.id}) | ||
self.registration2 = self.registration1.copy() | ||
self.registration2.event_id = self.event2 | ||
self.registrations = self.registration1 | self.registration2 | ||
self.wizard_model = self.env['event.registration.cancel.log.reason'] | ||
|
||
def test_cancel(self): | ||
action = self.registration1.button_reg_cancel() | ||
self.assertEqual(action.get('type'), 'ir.actions.act_window') | ||
wizard = self.wizard_model.with_context( | ||
active_ids=self.registrations.ids).create( | ||
{'reason_id': self.cancel_reason.id}) | ||
wizard.button_log() | ||
self.assertEqual( | ||
self.registration1.cancel_reason_id, self.cancel_reason) | ||
|
||
def test_cancel_multi_event_type(self): | ||
"""Registration cancel from different event types are aborted.""" | ||
self.event2.type = self.env.ref("event.event_type_2") | ||
with self.assertRaises(exceptions.ValidationError): | ||
self.wizard_model.with_context( | ||
active_ids=self.registrations.ids).create( | ||
{'reason_id': self.cancel_reason.id}) |
56 changes: 56 additions & 0 deletions
56
event_registration_cancel_reason/views/event_registration_view.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<openerp> | ||
<data> | ||
|
||
<record model="ir.ui.view" id="view_event_registration_form"> | ||
<field name="name">Event registration form (with cancellation reason)</field> | ||
<field name="model">event.registration</field> | ||
<field name="inherit_id" ref="event.view_event_registration_form"/> | ||
<field name="arch" type="xml"> | ||
<data> | ||
<xpath expr="//sheet/h1" position="after"> | ||
<h2 attrs="{'invisible':[('cancel_reason_id','=',False)]}"> | ||
<label for="cancel_reason_id" string="Cancellation Reason:"/> | ||
<field name="cancel_reason_id" class="oe_inline" options="{'no_open':True'}"/> | ||
</h2> | ||
</xpath> | ||
</data> | ||
</field> | ||
</record> | ||
|
||
<record model="ir.ui.view" id="view_registration_search"> | ||
<field name="name">Event registration search (with cancellation reason)</field> | ||
<field name="model">event.registration</field> | ||
<field name="inherit_id" ref="event.view_registration_search"/> | ||
<field name="arch" type="xml"> | ||
<filter context="{'group_by':'state'}" position="after"> | ||
<filter string="Cancellation reason" domain="[]" context="{'group_by': 'cancel_reason_id'}"/> | ||
</filter> | ||
</field> | ||
</record> | ||
|
||
<record model="ir.ui.view" id="event_registration_cancel_reason_tree"> | ||
<field name="name">Registrations cancellation reasons tree</field> | ||
<field name="model">event.registration.cancel.reason</field> | ||
<field name="arch" type="xml"> | ||
<tree name="Registration cancellation reasons" editable="top"> | ||
<field name="name"/> | ||
<field name="event_type_ids" widget="many2many_tags"/> | ||
</tree> | ||
</field> | ||
</record> | ||
|
||
<record id="event_registration_cancel_reason_action" model="ir.actions.act_window"> | ||
<field name="name">Registration cancellation reasons</field> | ||
<field name="res_model">event.registration.cancel.reason</field> | ||
<field name="view_type">form</field> | ||
<field name="view_mode">tree</field> | ||
</record> | ||
|
||
<menuitem action="event_registration_cancel_reason_action" | ||
id="menu_event_registration_cancel_reason" | ||
parent="event.event_configuration" | ||
/> | ||
|
||
</data> | ||
</openerp> |
Oops, something went wrong.