-
-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[10.0][WIP] event_sale_session: New module
- Loading branch information
1 parent
842fc71
commit 0d2018a
Showing
19 changed files
with
655 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,39 @@ | ||
.. 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 | ||
|
||
|
||
Sell tickets associated to sessions | ||
=================================== | ||
|
||
Adds the option of choosing a session when selling an event ticket | ||
|
||
Usage | ||
===== | ||
|
||
|
||
Known issues / Roadmap | ||
====================== | ||
|
||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Sergio Teruel <sergio.teruel@tecnativa.com> | ||
* David Vidal <david.vidal@tecnativa.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. |
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,4 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
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,26 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2017 David Vidal<david.vidal@tecnativa.com> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
'name': 'Event Sale Sessions', | ||
'version': '10.0.1.0.0', | ||
'author': 'Tecnativa, ' | ||
'Odoo Community Association (OCA)', | ||
"license": "AGPL-3", | ||
'website': 'https://odoo-community.org/', | ||
'category': 'Marketing', | ||
'summary': 'Sessions sales in events', | ||
'depends': [ | ||
'event_sale', | ||
'event_session', | ||
], | ||
'data': [ | ||
'security/ir.model.access.csv', | ||
'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,7 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
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,35 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2017 Sergio Teruel<sergio.teruel@tecnativa.com> | ||
# 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,38 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
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','=',self.id)]).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,17 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2017 David Vidal<david.vidal@tecnativa.com> | ||
# 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 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
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.