Skip to content

Commit

Permalink
Merge dd39c07 into 8283446
Browse files Browse the repository at this point in the history
  • Loading branch information
yajo committed Feb 17, 2016
2 parents 8283446 + dd39c07 commit df472f7
Show file tree
Hide file tree
Showing 14 changed files with 569 additions and 0 deletions.
122 changes: 122 additions & 0 deletions event_product_logistics/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
.. 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

==========================
Product Delivery in Events
==========================

Sometimes you want to give some products to your event's attendees. For
example: a pen, a notebook, a book, etc.

This module extends the functionality of events to support setting products to
deliver to event attendees and allow you to know if they have already been
delivered to them.

.. warning::
Please make no confusion between *event products* and *products to
deliver in events*:

* **Event products** are created in the ``event_product`` addon, and
define an event as a product (wedding, fair, etc.), to have a catalog
of them.
* **Products Delivery in Events** are created in this addon, and define
the products (goodies, leaflets, etc.) that you will deliver to event
attendees.

They can be defined in the *event product*, in the event directly, or in
both.

Usage
=====

To set products to deliver in an event product (see ``event_product`` module),
you need to:

#. Go to *Sales > Products > Product variants > Create*.
#. Set a name.
#. Enable *Is an event*.
#. Open the new tab called *Event*.
#. Set products to deliver there.

To set products to deliver in an event, you need to:

#. Go to *Marketing > Events > Events > Create*.
#. Set a name, start and end dates..
#. Open the *Products to Deliver* tab.
#. Do you want to get those products from the *event product* you just created?
- Yes.
#. Set that product in the *Product* field.
#. Press *Load from linked product*.
- No.
#. Set products to deliver directly on the list.

To mark those products as delivered to everyone, you need to:

#. Press the *Mark as delivered to all attendees* button there in the *Products
to Deliver* tab.

To mark those products as delivered to only one attendee, you need to:

#. Press the button that indicates the registration quantity, at the top of the
event form.
#. Choose one registration.
#. Check the *Products delivered* box.

To print a delivery receipt for those products, you need to:

#. Press the button that indicates the registration quantity, at the top of the
event form.
#. Choose all the registrations you want.
#. Press *Print > Products Delivery Receipt*.

.. 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

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

* Please read known issues section of ``event_product``'s README about
installation of the ``sale`` addon.
* Product deliveries currently do not create the corresponding stock moves.

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_product_logistics%0Aversion:%20
8.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Credits
=======

Images
------

* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.

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

* Jairo Llopis <yajo.sk8@gmail.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.
5 changes: 5 additions & 0 deletions event_product_logistics/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# © 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import models
24 changes: 24 additions & 0 deletions event_product_logistics/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# © 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Product Delivery in Events",
"summary": "Deliver products to event attendees",
"version": "8.0.1.0.0",
"category": "Event Management",
"website": "https://grupoesoc.es/",
"author": "Grupo ESOC Ingeniería de Servicios, "
"Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"event_product",
],
"data": [
"views/event.xml",
"views/product.xml",
"views/delivery_receipt_report.xml",
],
}
111 changes: 111 additions & 0 deletions event_product_logistics/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * event_product_logistics
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-12-29 13:50+0100\n"
"PO-Revision-Date: 2015-12-29 13:50+0100\n"
"Last-Translator: Jairo Llopis <j.llopis@grupoesoc.es>\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.5\n"

#. module: event_product_logistics
#: model:ir.model,name:event_product_logistics.model_event_event
#: view:product.template:event_product_logistics.product_template_form
msgid "Event"
msgstr "Evento"

#. module: event_product_logistics
#: model:ir.model,name:event_product_logistics.model_event_registration
msgid "Event Registration"
msgstr "Registro del evento"

#. module: event_product_logistics
#: code:addons/event_product_logistics/models/event.py:43
#, python-format
msgid "Event has no products set to deliver."
msgstr "El evento no tiene ningún producto a entregar."

#. module: event_product_logistics
#: help:event.registration,products_delivered:0
msgid "Have products been delivered to this attendee?"
msgstr "¿Se han entregado los productos a este asistente?"

#. module: event_product_logistics
#: view:event.event:event_product_logistics.event_event_form
msgid "Load from linked product"
msgstr "Cargar del producto vinculado"

#. module: event_product_logistics
#: view:event.event:event_product_logistics.event_event_form
msgid "Mark as delivered to all attendees"
msgstr "Marcar como entregado a todos los asistentes"

#. module: event_product_logistics
#: model:ir.model,name:event_product_logistics.model_product_template
msgid "Product Template"
msgstr "Plantilla de producto"

#. module: event_product_logistics
#: model:ir.actions.report.xml,name:event_product_logistics.product_delivery_receipt_action
#: view:website:event_product_logistics.delivery_receipt_report_translatable
msgid "Products Delivery Receipt"
msgstr "Recibo de entrega de productos"

#. module: event_product_logistics
#: field:event.registration,products_delivered:0
msgid "Products delivered"
msgstr "Productos entregados"

#. module: event_product_logistics
#: view:event.event:event_product_logistics.event_event_form
#: view:product.template:event_product_logistics.product_template_form
msgid "Products to Deliver"
msgstr "Productos a entregar"

#. module: event_product_logistics
#: field:event.event,deliverable_product_ids:0
msgid "Products to deliver"
msgstr "Productos a entregar"

#. module: event_product_logistics
#: field:product.template,event_deliverable_product_ids:0
msgid "Products to deliver in events"
msgstr "Productos a entregar en eventos"

#. module: event_product_logistics
#: view:website:event_product_logistics.delivery_receipt_report_translatable
msgid "Signed"
msgstr "Firmado"

#. module: event_product_logistics
#: view:website:event_product_logistics.delivery_receipt_report_translatable
msgid "These products have been delivered for the event"
msgstr "Estos productos se han entregado para el evento"

#. module: event_product_logistics
#: help:product.template,event_deliverable_product_ids:0
msgid ""
"These should be delivered to every attendee in any event related to this "
"product."
msgstr ""
"Estos deberían entregarse a cada asistente a cualquier evento relacionado "
"con este producto."

#. module: event_product_logistics
#: help:event.event,deliverable_product_ids:0
msgid "These should be delivered to every attendee."
msgstr "Estos se deberían entregar a cada asistente."

#. module: event_product_logistics
#: view:website:event_product_logistics.delivery_receipt_report_translatable
msgid "certifies having recieved the following products:"
msgstr "certifica haber recibido los siguientes productos:"
5 changes: 5 additions & 0 deletions event_product_logistics/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# © 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import event, product
50 changes: 50 additions & 0 deletions event_product_logistics/models/event.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# -*- coding: utf-8 -*-
# © 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

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


class EventEvent(models.Model):
_inherit = "event.event"

deliverable_product_ids = fields.Many2many(
"product.product",
string="Products to deliver",
domain=[("is_event", "=", False)],
help="These should be delivered to every attendee.")

@api.multi
def action_load_deliverable_products(self):
"""Load products to deliver from the linked product."""
for s in self:
s.deliverable_product_ids = (
s.product_id.event_deliverable_product_ids)

@api.multi
def action_products_delivered_to_all(self):
"""Mark all products delivered to all attendees."""
self.mapped("registration_ids").write({"products_delivered": True})

@api.multi
@api.onchange("deliverable_product_ids")
def _onchange_deliverable_product_ids(self):
"""Warn if products were already delivered."""
if True in self.mapped("registration_ids.products_delivered"):
raise exceptions.Warning(
_("Some products were already delivered."))


class EventRegistration(models.Model):
_inherit = "event.registration"

products_delivered = fields.Boolean(
help="Have products been delivered to this attendee?")

@api.constrains("products_delivered")
def _check_products_delivered(self):
"""Cannot deliver products if no products are set."""
for s in self:
if s.products_delivered and not s.event_id.deliverable_product_ids:
raise exceptions.ValidationError(
_("Event has no products set to deliver."))
16 changes: 16 additions & 0 deletions event_product_logistics/models/product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# © 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openerp import fields, models


class ProductTemplate(models.Model):
_inherit = "product.template"

event_deliverable_product_ids = fields.Many2many(
"product.product",
string="Products to deliver in events",
domain=[("is_event", "=", False)],
help="These should be delivered to every attendee in any event "
"related to this product.")
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions event_product_logistics/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# © 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import test_event
32 changes: 32 additions & 0 deletions event_product_logistics/tests/base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
# © 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).


class BaseCase(object):
def setUp(self, *args, **kwargs):
result = super(BaseCase, self).setUp(*args, **kwargs)

self.product = self.env["product.product"].create({
"name": u"Test ëvent 1",
"is_event": True,
})
self.deliverable_product_1 = self.env["product.product"].create({
"name": u"Têst deliverable 1",
})
self.deliverable_product_2 = self.env["product.product"].create({
"name": u"Têst deliverable 2",
})
self.deliverable_products = (self.deliverable_product_1 |
self.deliverable_product_2)
self.event = self.env["event.event"].create({
"name": u"Some evént.",
"date_begin": "2015-11-26",
"date_end": "2015-11-30",
})
self.event_registration = self.env["event.registration"].create({
"name": u"Some registratioǹ",
"event_id": self.event.id,
})

return result
Loading

0 comments on commit df472f7

Please sign in to comment.