Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
1,245 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,86 @@ | ||
=================== | ||
Event Sale Sessions | ||
=================== | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! 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/12.0/event_sale_session | ||
:alt: OCA/event | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/event-12-0/event-12-0-event_sale_session | ||
: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/12.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
Adds the option of choosing a session when selling an event ticket. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Usage | ||
===== | ||
|
||
To use this module, you need to: | ||
|
||
#. Place a sale order and choose an event registration product. | ||
#. If the event has sessions, you'll be compelled to choose one. | ||
#. The registration will be added to such session once the sale order is | ||
confirmed. | ||
|
||
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_session%0Aversion:%2012.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>`__: | ||
|
||
* Sergio Teruel | ||
* David Vidal | ||
|
||
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. | ||
|
||
This module is part of the `OCA/event <https://github.com/OCA/event/tree/12.0/event_sale_session>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
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,3 @@ | ||
from . import models | ||
from . import reports | ||
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,25 @@ | ||
# Copyright 2017-19 Tecnativa - David Vidal | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
{ | ||
'name': 'Event Sale Sessions', | ||
'summary': 'Sessions sales in events', | ||
'version': '12.0.1.0.0', | ||
'author': 'Tecnativa, ' | ||
'Odoo Community Association (OCA)', | ||
"license": "AGPL-3", | ||
'website': 'https://github.com/OCA/event', | ||
'category': 'Marketing', | ||
'depends': [ | ||
'event_sale', | ||
'event_session', | ||
], | ||
'data': [ | ||
'security/ir.model.access.csv', | ||
'reports/sale_report_views.xml', | ||
'views/sale_order_views.xml', | ||
'views/event_view.xml', | ||
'views/event_session_view.xml', | ||
'wizard/event_edit_registration.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,139 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * event_sale_session | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 10.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2017-06-14 11:31+0000\n" | ||
"PO-Revision-Date: 2017-06-14 14:10+0200\n" | ||
"Last-Translator: David <david.vidal@tecnativa.com>\n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: \n" | ||
"Language: es\n" | ||
"X-Generator: Poedit 1.8.7.1\n" | ||
|
||
#. module: event_sale_session | ||
#: model:ir.model,name:event_sale_session.model_event_registration | ||
msgid "Attendee" | ||
msgstr "Asistentes" | ||
|
||
#. module: event_sale_session | ||
#: model:ir.model.fields,field_description:event_sale_session.field_sale_order_line_registration_ids | ||
#: model:ir.model.fields,field_description:event_sale_session.field_sale_order_registration_ids | ||
msgid "Attendees" | ||
msgstr "Asistentes" | ||
|
||
#. module: event_sale_session | ||
#: model:ir.model.fields,field_description:event_sale_session.field_sale_order_line_event_session_seats_available | ||
msgid "Available Seats" | ||
msgstr "Plazas disponibles" | ||
|
||
#. module: event_sale_session | ||
#: model:ir.model,name:event_sale_session.model_event_event | ||
#: model:ir.model.fields,field_description:event_sale_session.field_sale_order_event_ids | ||
msgid "Event" | ||
msgstr "Evento" | ||
|
||
#. module: event_sale_session | ||
#: model:ir.model,name:event_sale_session.model_event_session | ||
msgid "Event session" | ||
msgstr "Sesión" | ||
|
||
#. module: event_sale_session | ||
#: model:ir.model,name:event_sale_session.model_account_invoice | ||
msgid "Invoice" | ||
msgstr "Factura" | ||
|
||
#. module: event_sale_session | ||
#: code:addons/event_sale_session/models/sale_order.py:73 | ||
#, python-format | ||
msgid "Not enough seats. Change quanty or session" | ||
msgstr "No hay plazas suficientes. Cambia la cantidad o escoge otra sesión." | ||
|
||
#. module: event_sale_session | ||
#: model:ir.actions.act_window,name:event_sale_session.act_event_session_unconfirmed_qty | ||
msgid "Orders" | ||
msgstr "Pedidos" | ||
|
||
#. module: event_sale_session | ||
#: model:ir.model,name:event_sale_session.model_sale_order | ||
msgid "Sales Order" | ||
msgstr "Pedido de venta" | ||
|
||
#. module: event_sale_session | ||
#: model:ir.model,name:event_sale_session.model_sale_order_line | ||
msgid "Sales Order Line" | ||
msgstr "Línea de pedido de venta" | ||
|
||
#. module: event_sale_session | ||
#: model:ir.model.fields,field_description:event_sale_session.field_event_event_order_line_ids | ||
#: model:ir.model.fields,field_description:event_sale_session.field_event_session_order_line_ids | ||
msgid "Sales Order Lines" | ||
msgstr "Líneas de pedido de venta" | ||
|
||
#. module: event_sale_session | ||
#: model:ir.model.fields,field_description:event_sale_session.field_sale_order_line_event_session_seats_availability | ||
msgid "Seats Availavility" | ||
msgstr "Disponibilidad de plazas" | ||
|
||
#. module: event_sale_session | ||
#: model:ir.model.fields,field_description:event_sale_session.field_registration_editor_line_session_id | ||
#: model:ir.model.fields,field_description:event_sale_session.field_sale_order_line_session_id | ||
msgid "Session" | ||
msgstr "Sesión" | ||
|
||
#. module: event_sale_session | ||
#: code:addons/event_sale_session/models/sale_order.py:63 | ||
#, python-format | ||
msgid "" | ||
"There are sessions with no available seats!\n" | ||
"Edit them so you can save the sale order" | ||
msgstr "" | ||
"Estás intentando reservar en una sesión sin plazas.\n" | ||
"Edítal para que puedas guardar tu pedido." | ||
|
||
#. module: event_sale_session | ||
#: model:ir.ui.view,arch_db:event_sale_session.view_event_session_form | ||
msgid "Ticket" | ||
msgstr "Ticket" | ||
|
||
#. module: event_sale_session | ||
#: model:ir.model.fields,field_description:event_sale_session.field_sale_order_line_event_sessions_count | ||
msgid "Total event sessions" | ||
msgstr "Sesiones de evento totales" | ||
|
||
#. module: event_sale_session | ||
#: model:ir.ui.view,arch_db:event_sale_session.view_event_session_tree | ||
msgid "Total unconfirmed seats in orders" | ||
msgstr "Total plazas de pedidos no confirmados" | ||
|
||
#. module: event_sale_session | ||
#: model:ir.model.fields,field_description:event_sale_session.field_event_event_unconfirmed_qty | ||
#: model:ir.model.fields,field_description:event_sale_session.field_event_session_unconfirmed_qty | ||
msgid "Unconfirmed Qty" | ||
msgstr "Cantidad sin asignar" | ||
|
||
#. module: event_sale_session | ||
#: model:ir.ui.view,arch_db:event_sale_session.view_event_form | ||
msgid "Unconfirmed order seats" | ||
msgstr "Plazas en pedidos sin confirmar" | ||
|
||
#. module: event_sale_session | ||
#: model:ir.ui.view,arch_db:event_sale_session.view_event_form | ||
msgid "Unconfirmed orders seats" | ||
msgstr "Plazas en pedidos sin confirmar" | ||
|
||
#. module: event_sale_session | ||
#: model:ir.model,name:event_sale_session.model_registration_editor | ||
msgid "registration.editor" | ||
msgstr "registration.editor" | ||
|
||
#. module: event_sale_session | ||
#: model:ir.model,name:event_sale_session.model_registration_editor_line | ||
msgid "registration.editor.line" | ||
msgstr "registration.editor.line" |
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,5 @@ | ||
from . import account_invoice | ||
from . import event_event | ||
from . import event_registration | ||
from . import event_session | ||
from . import sale_order |
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,33 @@ | ||
# Copyright 2017 Tecnativa - Sergio Teruel | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
from odoo import api, models | ||
|
||
|
||
class AccountInvoice(models.Model): | ||
_inherit = "account.invoice" | ||
|
||
@api.multi | ||
def action_cancel(self): | ||
res = super(AccountInvoice, self).action_cancel() | ||
if res and not self.env.context.get('is_merge', False): | ||
self.mapped( | ||
'invoice_line_ids.sale_line_ids.registration_ids').filtered( | ||
lambda x: x.state not in ['done', 'draft'] | ||
).do_draft() | ||
return res | ||
|
||
@api.multi | ||
def unlink(self): | ||
registrations = self.mapped( | ||
'invoice_line_ids.sale_line_ids.registration_ids').filtered( | ||
lambda x: x.state not in ['done', 'draft']) | ||
res = super(AccountInvoice, self).unlink() | ||
if res: | ||
registrations.filtered( | ||
lambda x: x.state not in ['done', 'draft']).do_draft() | ||
|
||
@api.multi | ||
def action_invoice_draft(self): | ||
res = super(AccountInvoice, self).action_invoice_draft() | ||
if res: | ||
self._confirm_attendees() |
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,37 @@ | ||
# Copyright 2017-19 Tecnativa - David Vidal | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
from odoo import api, fields, models | ||
|
||
|
||
class EventSession(models.Model): | ||
_inherit = 'event.event' | ||
|
||
order_line_ids = fields.One2many( | ||
comodel_name='sale.order.line', | ||
inverse_name='event_id', | ||
string='Sales Order Lines' | ||
) | ||
unconfirmed_qty = fields.Integer( | ||
string='Unconfirmed Qty', | ||
compute='_compute_unconfirmed_qty', | ||
store=True, | ||
) | ||
|
||
@api.depends('order_line_ids', 'order_line_ids.product_uom_qty', | ||
'order_line_ids.order_id.state') | ||
@api.multi | ||
def _compute_unconfirmed_qty(self): | ||
for event in self: | ||
event.unconfirmed_qty = int(sum(event.order_line_ids.filtered( | ||
lambda x: x.order_id.state in ('draft', 'sent') | ||
).mapped('product_uom_qty'))) | ||
|
||
@api.multi | ||
def button_open_unconfirmed_event_order(self): | ||
action = self.env.ref('sale.action_quotations').read()[0] | ||
sales = self.env['sale.order.line'].search([ | ||
('event_id', 'in', self.ids)]).mapped('order_id').ids | ||
action['domain'] = [('id', 'in' , sales), | ||
('state', 'in', ('draft', 'sent'))] | ||
action['context'] = {} | ||
return action |
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,15 @@ | ||
# Copyright 2017-19 Tecnativa - David Vidal | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
from odoo import api, models | ||
|
||
|
||
class EventRegistration(models.Model): | ||
_inherit = 'event.registration' | ||
|
||
@api.model | ||
def _prepare_attendee_values(self, registration): | ||
data = super(EventRegistration, self)._prepare_attendee_values( | ||
registration) | ||
session_id = registration['sale_order_line_id'].session_id.id | ||
data.update({'session_id': session_id}) | ||
return data |
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,27 @@ | ||
# Copyright 2017-19 Tecnativa - David Vidal | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
from odoo import api, fields, models | ||
|
||
|
||
class EventSession(models.Model): | ||
_inherit = 'event.session' | ||
|
||
order_line_ids = fields.One2many( | ||
comodel_name='sale.order.line', | ||
inverse_name='session_id', | ||
string='Sales Order Lines' | ||
) | ||
unconfirmed_qty = fields.Integer( | ||
string='Unconfirmed Qty', | ||
compute='_compute_unconfirmed_qty', | ||
store=True, | ||
) | ||
|
||
@api.depends('order_line_ids', 'order_line_ids.product_uom_qty', | ||
'order_line_ids.order_id.state') | ||
@api.multi | ||
def _compute_unconfirmed_qty(self): | ||
for session in self: | ||
session.unconfirmed_qty = int(sum(session.order_line_ids.filtered( | ||
lambda x: x.order_id.state in ('draft', 'sent') | ||
).mapped('product_uom_qty'))) |
Oops, something went wrong.