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

[13.0][MIG] event_sale_reservation: Migration to 13.0 #254

Merged
merged 4 commits into from
Feb 3, 2022
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
6 changes: 6 additions & 0 deletions event_sale_registration_multi_qty/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ def _update_registrations(
self, confirm=True, cancel_to_draft=False, registration_data=None
):
"""Update registrations on events with multi qty enabled"""
if self.env.context.get("skip_event_sale_registration_multi_qty"):
return super()._update_registrations(
confirm=confirm,
cancel_to_draft=cancel_to_draft,
registration_data=registration_data,
)
Registration = self.env["event.registration"]
for so_line in self.filtered("event_id"):
if not so_line.event_id.registration_multi_qty:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class RegistrationEditor(models.TransientModel):
@api.model
def default_get(self, fields):
res = super().default_get(fields)
if self.env.context.get("skip_event_sale_registration_multi_qty"):
return res
Event = self.env["event.event"]
SaleOrderLine = self.env["sale.order.line"]
attendees = [(6, 0, [])]
Expand Down
173 changes: 173 additions & 0 deletions event_sale_reservation/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
=======================
Sell event reservations
=======================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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%2Fevent-lightgray.png?logo=github
:target: https://github.com/OCA/event/tree/13.0/event_sale_reservation
:alt: OCA/event
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/event-13-0/event-13-0-event_sale_reservation
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/199/13.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

This module extends the functionality of event_sale to support selling
reservations of events that still don't exist and to allow you to schedule the
creation of events based on how many reservations already exist.

**Table of contents**

.. contents::
:local:

Installation
============

To install this module, you need to:

#. Install ``web_ir_actions_act_multi`` from https://github.com/OCA/web
#. Install ``web_ir_actions_act_view_reload`` from https://github.com/OCA/web

Configuration
=============


To make use of this module, a user needs these minimal permissions:

- Sales / User: Own Documents Only
- Events / User

Usage
=====

To know how many reservations exist for a given event type:

#. Go to *Events > Configuration > Event Categories* and pick or create one.
#. There's a new smart button called *Reserved seats* with that count.
#. Click on it to get to the sales orders where the seats got reserved.

But that counter will be probably zero when you install, so let's see how to
increase it.

To create an event reservation product:

#. Go to *Sales > Products > Products*.
#. Create one.
#. Set its basic info (name, price...) and go to *Sales* tab.
#. Under *Events*, tick *Is an event reservation*.
#. Select one *Event type for reservations*.
#. Save.

From now on, you can sell event reservations for that event type. To do it:

#. Go to *Sales > Orders > Quotations*.
#. Create one.
#. Set its basic info (customer, date...) and go to *Order lines* tab.
#. Click *Add a product*.
#. Select the event reservation product you created above.
#. Set its info (quantity, price...).
#. Save that line and the quotation.

At this point, the reservation is not yet confirmed, so if you go to the event
type, the smart button will still count zero.

To confirm those reservations:

#. Go to the quotation you just created (if you are not there yet).
#. Click on *Confirm*.

Now, if you go to the event type form, the smart button will indicate how many
reserved seats exist.

If you want to convert those reservations into real event registrations:

#. Go to the quotation you just created (if you are not there yet).
#. Click on *Register in event*.
#. In the wizard you see, set the *Event* and *Event Ticket* for all the order
lines you want to convert into registrations.
#. If there is any line you still don't want to convert, remove it from the
wizard.
#. Click on *Next*.
#. A new wizard will appear, where you will be able to specify the name, email
and phone of each one of the attendees. If you don't do it, they will get
that info from the sales order customer.
#. After that's done, click on *Apply*.

At this point, the sales order lines will be modified to include the ticket
product instead of the reservation product, and the event reservations have
been created, linked to those lines.

If the ticket was free, the registrations are confirmed. Otherwise, they are
kept as draft until an invoice is created for the sales order, and paid. But
that is just upstream ``event_sale`` module in action.

Known issues / Roadmap
======================

Some addons (event_registration_multi_qty + event_sale_registration_multi_qty)
makes totals wrong because they depend currently on count and not sum of qtys;
integrating with them would require a glue module.

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:%20event_sale_reservation%0Aversion:%2013.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>`_:

* Jairo Llopis

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-Yajo| image:: https://github.com/Yajo.png?size=40px
:target: https://github.com/Yajo
:alt: Yajo

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-Yajo|

This module is part of the `OCA/event <https://github.com/OCA/event/tree/13.0/event_sale_reservation>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions event_sale_reservation/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import models
from . import reports
from . import wizards
28 changes: 28 additions & 0 deletions event_sale_reservation/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2021 Tecnativa - Jairo Llopis
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Sell event reservations",
"summary": "Allow selling event registrations before the event exists",
"version": "13.0.1.0.0",
"development_status": "Beta",
"category": "Marketing",
"website": "https://github.com/OCA/event",
"author": "Tecnativa, Odoo Community Association (OCA)",
"maintainers": ["Yajo"],
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"event_sale",
"web_ir_actions_act_multi",
"web_ir_actions_act_view_reload",
],
"data": [
"reports/sale_report_view.xml",
"wizards/registration_editor_view.xml",
"views/event_type_view.xml",
"views/product_template_view.xml",
"views/sale_order_view.xml",
],
}
12 changes: 12 additions & 0 deletions event_sale_reservation/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2021 Tecnativa - Jairo Llopis
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import exceptions


class TicketAndReservationError(exceptions.ValidationError):
pass


class ReservationWithoutEventTypeError(exceptions.ValidationError):
pass
Loading