Skip to content

Commit

Permalink
Merge PR #415 into 17.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Dec 11, 2024
2 parents a472ee4 + 5dc2c70 commit f62a216
Show file tree
Hide file tree
Showing 18 changed files with 903 additions and 0 deletions.
81 changes: 81 additions & 0 deletions event_min_seat/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
=======================
Minimum seats in events
=======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:3f299706cc21954b302192582780535e45052114a0eb5b5aecaae131b1e4b011
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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/17.0/event_min_seat
:alt: OCA/event
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/event-17-0/event-17-0-event_min_seat
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/event&target_branch=17.0
:alt: Try me on Runboat

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

This module recovers the lost feature for specifying the minimum seats
required for an event, and showing such events on red in the list view
if the minimum seats are not satisfied.

**Table of contents**

.. contents::
:local:

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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/event/issues/new?body=module:%20event_min_seat%0Aversion:%2017.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>`__:

- Pedro M. Baeza
- Pilar Vargas

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/17.0/event_min_seat>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions event_min_seat/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import models
17 changes: 17 additions & 0 deletions event_min_seat/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2023 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Minimum seats in events",
"version": "17.0.1.0.0",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"website": "https://github.com/OCA/event",
"category": "Marketing",
"depends": ["event"],
"data": [
"views/event_event_views.xml",
"views/event_type_views.xml",
],
"installable": True,
}
73 changes: 73 additions & 0 deletions event_min_seat/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * event_min_seat
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-08-03 18:13+0000\n"
"PO-Revision-Date: 2023-10-29 23:38+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.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: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: event_min_seat
#: model_terms:ir.ui.view,arch_db:event_min_seat.view_event_form
#: model_terms:ir.ui.view,arch_db:event_min_seat.view_event_type_form
msgid "&amp;nbsp;"
msgstr "&amp;nbsp;"

#. module: event_min_seat
#: model:ir.model,name:event_min_seat.model_event_event
msgid "Event"
msgstr "Evento"

#. module: event_min_seat
#: model:ir.model,name:event_min_seat.model_event_type
msgid "Event Template"
msgstr "Plantilla de evento"

#. module: event_min_seat
#: model:ir.model.fields,help:event_min_seat.field_event_event__seats_min
msgid ""
"For each event you can define a minimum reserved seats (number of "
"attendees). If it does not reach the mentioned registrations, the event is "
"highlighted in the list."
msgstr ""
"Para cada evento, puede definir un mínimo de sitios reservados (número de "
"asistentes). Si no alcanza los registros mencionados, el evento será "
"resaltado en la lista."

#. module: event_min_seat
#: model:ir.model.fields,help:event_min_seat.field_event_type__default_registration_min
msgid "It will select this default minimum value when you choose this event"
msgstr "Seleccionará este valor mínimo por defecto cuando escoja este evento"

#. module: event_min_seat
#: code:addons/event_min_seat/models/event_event.py:0
#, python-format
msgid ""
"Maximum attendees number should be greater than minimum attendees number."
msgstr "El número máximo de asistentes debe ser mayor que el mínimo."

#. module: event_min_seat
#: model:ir.model.fields,field_description:event_min_seat.field_event_type__default_registration_min
msgid "Minimum Registrations"
msgstr "Registros mínimos"

#. module: event_min_seat
#: model:ir.model.fields,field_description:event_min_seat.field_event_event__seats_min
msgid "Minimum Seats"
msgstr "Asientos mínimos"

#. module: event_min_seat
#: model_terms:ir.ui.view,arch_db:event_min_seat.view_event_form
#: model_terms:ir.ui.view,arch_db:event_min_seat.view_event_type_form
msgid "from"
msgstr "desde"
66 changes: 66 additions & 0 deletions event_min_seat/i18n/event_min_seat.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * event_min_seat
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: event_min_seat
#: model_terms:ir.ui.view,arch_db:event_min_seat.view_event_form
#: model_terms:ir.ui.view,arch_db:event_min_seat.view_event_type_form
msgid "&amp;nbsp;"
msgstr ""

#. module: event_min_seat
#: model:ir.model,name:event_min_seat.model_event_event
msgid "Event"
msgstr ""

#. module: event_min_seat
#: model:ir.model,name:event_min_seat.model_event_type
msgid "Event Template"
msgstr ""

#. module: event_min_seat
#: model:ir.model.fields,help:event_min_seat.field_event_event__seats_min
msgid ""
"For each event you can define a minimum reserved seats (number of "
"attendees). If it does not reach the mentioned registrations, the event is "
"highlighted in the list."
msgstr ""

#. module: event_min_seat
#: model:ir.model.fields,help:event_min_seat.field_event_type__default_registration_min
msgid "It will select this default minimum value when you choose this event"
msgstr ""

#. module: event_min_seat
#: code:addons/event_min_seat/models/event_event.py:0
#, python-format
msgid ""
"Maximum attendees number should be greater than minimum attendees number."
msgstr ""

#. module: event_min_seat
#: model:ir.model.fields,field_description:event_min_seat.field_event_type__default_registration_min
msgid "Minimum Registrations"
msgstr ""

#. module: event_min_seat
#: model:ir.model.fields,field_description:event_min_seat.field_event_event__seats_min
msgid "Minimum Seats"
msgstr ""

#. module: event_min_seat
#: model_terms:ir.ui.view,arch_db:event_min_seat.view_event_form
#: model_terms:ir.ui.view,arch_db:event_min_seat.view_event_type_form
msgid "from"
msgstr ""
76 changes: 76 additions & 0 deletions event_min_seat/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * event_min_seat
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-11-22 09:35+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: event_min_seat
#: model_terms:ir.ui.view,arch_db:event_min_seat.view_event_form
#: model_terms:ir.ui.view,arch_db:event_min_seat.view_event_type_form
msgid "&amp;nbsp;"
msgstr "&amp;nbsp;"

#. module: event_min_seat
#: model:ir.model,name:event_min_seat.model_event_event
msgid "Event"
msgstr "Evento"

#. module: event_min_seat
#: model:ir.model,name:event_min_seat.model_event_type
msgid "Event Template"
msgstr "Modello evento"

#. module: event_min_seat
#: model:ir.model.fields,help:event_min_seat.field_event_event__seats_min
msgid ""
"For each event you can define a minimum reserved seats (number of "
"attendees). If it does not reach the mentioned registrations, the event is "
"highlighted in the list."
msgstr ""
"Per ogni evento si può definire un numero minimo di posti prenotati (numero "
"di partecipanti). Se non si raggiungono le registrazioni indicate, l'evento "
"verrà evidenziato nell'elenco."

#. module: event_min_seat
#: model:ir.model.fields,help:event_min_seat.field_event_type__default_registration_min
msgid "It will select this default minimum value when you choose this event"
msgstr ""
"Verrà selezionato questo numero minimo predefinito quando si sceglie questo "
"evento"

#. module: event_min_seat
#: code:addons/event_min_seat/models/event_event.py:0
#, python-format
msgid ""
"Maximum attendees number should be greater than minimum attendees number."
msgstr ""
"Il numero massimo di partecipanti deve essere superiore al numero minimo di "
"partecipanti."

#. module: event_min_seat
#: model:ir.model.fields,field_description:event_min_seat.field_event_type__default_registration_min
msgid "Minimum Registrations"
msgstr "Registrazioni minime"

#. module: event_min_seat
#: model:ir.model.fields,field_description:event_min_seat.field_event_event__seats_min
msgid "Minimum Seats"
msgstr "Posti minimi"

#. module: event_min_seat
#: model_terms:ir.ui.view,arch_db:event_min_seat.view_event_form
#: model_terms:ir.ui.view,arch_db:event_min_seat.view_event_type_form
msgid "from"
msgstr "dal"
3 changes: 3 additions & 0 deletions event_min_seat/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import event_event
from . import event_type
34 changes: 34 additions & 0 deletions event_min_seat/models/event_event.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2023 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, api, exceptions, fields, models


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

seats_min = fields.Integer(
string="Minimum Seats",
compute="_compute_seats_min",
readonly=False,
store=True,
help="For each event you can define a minimum reserved seats (number of "
"attendees). If it does not reach the mentioned registrations, the event is "
"highlighted in the list.",
)

@api.depends("event_type_id")
def _compute_seats_min(self):
for event in self.filtered("event_type_id"):
event.seats_min = event.event_type_id.default_registration_min

@api.constrains("seats_min", "seats_max", "seats_limited")
def _check_seats_min_max(self):
if any(
event.seats_limited and event.seats_min > event.seats_max for event in self
):
raise exceptions.ValidationError(
_(
"Maximum attendees number should be greater than minimum attendees "
"number."
)
)
19 changes: 19 additions & 0 deletions event_min_seat/models/event_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2023 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models


class EventType(models.Model):
_inherit = "event.type"

default_registration_min = fields.Integer(
"Minimum Registrations",
compute="_compute_default_registration_min",
readonly=False,
store=True,
help="It will select this default minimum value when you choose this event",
)

@api.depends("has_seats_limitation")
def _compute_default_registration_min(self):
self.filtered(lambda x: not x.has_seats_limitation).default_registration_min = 0
3 changes: 3 additions & 0 deletions event_min_seat/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
4 changes: 4 additions & 0 deletions event_min_seat/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- [Tecnativa](https://www.tecnativa.com):

> - Pedro M. Baeza
> - Pilar Vargas
3 changes: 3 additions & 0 deletions event_min_seat/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This module recovers the lost feature for specifying the minimum seats
required for an event, and showing such events on red in the list view
if the minimum seats are not satisfied.
Binary file added event_min_seat/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit f62a216

Please sign in to comment.