diff --git a/website_event_no_registration/README.rst b/website_event_no_registration/README.rst new file mode 100644 index 0000000000..d0eb994a8b --- /dev/null +++ b/website_event_no_registration/README.rst @@ -0,0 +1,98 @@ +=============================== +Website Event - No registration +=============================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:158e89f61f2770f93ad3c67969c8e4726a8e73cc45e4225c218e405d0ca602a4 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fwebsite-lightgray.png?logo=github + :target: https://github.com/OCA/website/tree/18.0/website_event_no_registration + :alt: OCA/website +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/website-18-0/website-18-0-website_event_no_registration + :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/website&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends the ``website_event`` Odoo module to provide an +extra option on the model ``event.event``, to disable registrations. +Such features is interesting if we want to display on the websites, +event organized by third parties. In that case, registrations are +managed in other websites. + +|event_form| + +As a result, the button to register is hidden in the website event form +view. + +|website_event| + +.. |event_form| image:: https://raw.githubusercontent.com/OCA/website/18.0/website_event_no_registration/static/description/event_form.png +.. |website_event| image:: https://raw.githubusercontent.com/OCA/website/18.0/website_event_no_registration/static/description/website_event.png + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* GRAP + +Contributors +------------ + +- Sylvain LE GAL + +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-legalsylvain| image:: https://github.com/legalsylvain.png?size=40px + :target: https://github.com/legalsylvain + :alt: legalsylvain + +Current `maintainer `__: + +|maintainer-legalsylvain| + +This module is part of the `OCA/website `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/website_event_no_registration/__init__.py b/website_event_no_registration/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/website_event_no_registration/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/website_event_no_registration/__manifest__.py b/website_event_no_registration/__manifest__.py new file mode 100644 index 0000000000..4a193680b3 --- /dev/null +++ b/website_event_no_registration/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2026 - Today: GRAP https://www.grap.coop +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). +{ + "name": "Website Event - No registration", + "summary": "Add option to prevent registration of event" + " organized by third party.", + "version": "18.0.1.0.0", + "author": "GRAP, Odoo Community Association (OCA)", + "maintainers": ["legalsylvain"], + "website": "https://github.com/OCA/website", + "license": "AGPL-3", + "category": "Website", + "depends": ["website_event"], + "data": [ + "views/view_event_event.xml", + "views/event_templates.xml", + "views/view_event_type.xml", + ], +} diff --git a/website_event_no_registration/i18n/fr.po b/website_event_no_registration/i18n/fr.po new file mode 100644 index 0000000000..602cf2ce33 --- /dev/null +++ b/website_event_no_registration/i18n/fr.po @@ -0,0 +1,26 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_event_no_registration +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2026-10-05 23:40+0000\n" +"PO-Revision-Date: 2026-10-05 23:40+0000\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: website_event_no_registration +#: model:ir.model,name:website_event_no_registration.model_event_event +msgid "Event" +msgstr "Événement" + +#. module: website_event_no_registration +#: model:ir.model.fields,field_description:website_event_no_registration.field_event_event__registration_allowed +msgid "Registration Allowed" +msgstr "Réservation possible" diff --git a/website_event_no_registration/models/__init__.py b/website_event_no_registration/models/__init__.py new file mode 100644 index 0000000000..999bca560c --- /dev/null +++ b/website_event_no_registration/models/__init__.py @@ -0,0 +1,2 @@ +from . import event_type +from . import event_event diff --git a/website_event_no_registration/models/event_event.py b/website_event_no_registration/models/event_event.py new file mode 100644 index 0000000000..c71e28befd --- /dev/null +++ b/website_event_no_registration/models/event_event.py @@ -0,0 +1,38 @@ +# Copyright 2026 - Today: GRAP https://www.grap.coop +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). + +from odoo import api, fields, models + + +class EventEvent(models.Model): + _inherit = "event.event" + + registration_allowed = fields.Boolean( + copy=True, compute="_compute_registration_allowed", readonly=False, store=True + ) + + @api.depends("event_type_id") + def _compute_registration_allowed(self): + for event in self: + if not event.event_type_id: + event.registration_allowed = True + else: + event.registration_allowed = event.event_type_id.registration_allowed + + @api.depends( + "date_tz", + "event_registrations_started", + "date_end", + "seats_available", + "seats_limited", + "seats_max", + "event_ticket_ids.sale_available", + "registration_allowed", + ) + def _compute_event_registrations_open(self): + res = super( + EventEvent, self.filtered(lambda x: x.registration_allowed) + )._compute_event_registrations_open() + for event in self.filtered(lambda x: not x.registration_allowed): + event.event_registrations_open = False + return res diff --git a/website_event_no_registration/models/event_type.py b/website_event_no_registration/models/event_type.py new file mode 100644 index 0000000000..c047bfff7f --- /dev/null +++ b/website_event_no_registration/models/event_type.py @@ -0,0 +1,10 @@ +# Copyright 2026 - Today: GRAP https://www.grap.coop +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). + +from odoo import fields, models + + +class EventType(models.Model): + _inherit = "event.type" + + registration_allowed = fields.Boolean(default=True) diff --git a/website_event_no_registration/pyproject.toml b/website_event_no_registration/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/website_event_no_registration/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/website_event_no_registration/readme/CONTRIBUTORS.md b/website_event_no_registration/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..fea5f58349 --- /dev/null +++ b/website_event_no_registration/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Sylvain LE GAL \ No newline at end of file diff --git a/website_event_no_registration/readme/DESCRIPTION.md b/website_event_no_registration/readme/DESCRIPTION.md new file mode 100644 index 0000000000..f0a7015477 --- /dev/null +++ b/website_event_no_registration/readme/DESCRIPTION.md @@ -0,0 +1,10 @@ +This module extends the ``website_event`` Odoo module to provide an extra option +on the model ``event.event``, to disable registrations. +Such features is interesting if we want to display on the websites, event organized +by third parties. In that case, registrations are managed in other websites. + +![event_form](../static/description/event_form.png) + +As a result, the button to register is hidden in the website event form view. + +![website_event](../static/description/website_event.png) diff --git a/website_event_no_registration/static/description/event_form.png b/website_event_no_registration/static/description/event_form.png new file mode 100644 index 0000000000..dd569a32fb Binary files /dev/null and b/website_event_no_registration/static/description/event_form.png differ diff --git a/website_event_no_registration/static/description/index.html b/website_event_no_registration/static/description/index.html new file mode 100644 index 0000000000..ce310a54f0 --- /dev/null +++ b/website_event_no_registration/static/description/index.html @@ -0,0 +1,433 @@ + + + + + +Website Event - No registration + + + +
+

Website Event - No registration

+ + +

Beta License: AGPL-3 OCA/website Translate me on Weblate Try me on Runboat

+

This module extends the website_event Odoo module to provide an +extra option on the model event.event, to disable registrations. +Such features is interesting if we want to display on the websites, +event organized by third parties. In that case, registrations are +managed in other websites.

+

event_form

+

As a result, the button to register is hidden in the website event form +view.

+

website_event

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • GRAP
  • +
+
+
+

Contributors

+
    +
  • Sylvain LE GAL
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

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.

+

Current maintainer:

+

legalsylvain

+

This module is part of the OCA/website project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/website_event_no_registration/static/description/website_event.png b/website_event_no_registration/static/description/website_event.png new file mode 100644 index 0000000000..a0bc73957f Binary files /dev/null and b/website_event_no_registration/static/description/website_event.png differ diff --git a/website_event_no_registration/tests/__init__.py b/website_event_no_registration/tests/__init__.py new file mode 100644 index 0000000000..54fef876cf --- /dev/null +++ b/website_event_no_registration/tests/__init__.py @@ -0,0 +1 @@ +from . import test_website_event_no_registration diff --git a/website_event_no_registration/tests/test_website_event_no_registration.py b/website_event_no_registration/tests/test_website_event_no_registration.py new file mode 100644 index 0000000000..0063569fbd --- /dev/null +++ b/website_event_no_registration/tests/test_website_event_no_registration.py @@ -0,0 +1,27 @@ +from datetime import datetime + +from freezegun import freeze_time + +from odoo.addons.event.tests.test_event_internals import TestEventInternalsCommon + + +class testWebsiteEventNoRegistration(TestEventInternalsCommon): + @freeze_time("2020-1-31 10:00:00") + def test_event_registrable(self): + """Test if `_compute_event_registrations_open` works properly.""" + self.event_0.write( + { + "date_begin": datetime(2020, 1, 30, 8, 0, 0), + "date_end": datetime(2020, 1, 31, 8, 0, 0), + } + ) + self.assertFalse(self.event_0.event_registrations_open) + self.event_0.write( + { + "date_end": datetime(2020, 2, 4, 8, 0, 0), + } + ) + self.assertTrue(self.event_0.event_registrations_open) + + self.event_0.write({"registration_allowed": False}) + self.assertFalse(self.event_0.event_registrations_open) diff --git a/website_event_no_registration/views/event_templates.xml b/website_event_no_registration/views/event_templates.xml new file mode 100644 index 0000000000..667808267c --- /dev/null +++ b/website_event_no_registration/views/event_templates.xml @@ -0,0 +1,29 @@ + + + + + + diff --git a/website_event_no_registration/views/view_event_event.xml b/website_event_no_registration/views/view_event_event.xml new file mode 100644 index 0000000000..c6de168ab2 --- /dev/null +++ b/website_event_no_registration/views/view_event_event.xml @@ -0,0 +1,37 @@ + + + + event.event + + + + + + + not registration_allowed + + + not registration_allowed + + + not registration_allowed + + + not registration_allowed + + + not registration_allowed + + + not registration_allowed + + + not registration_allowed + + + + not registration_allowed + + + + diff --git a/website_event_no_registration/views/view_event_type.xml b/website_event_no_registration/views/view_event_type.xml new file mode 100644 index 0000000000..2a9589ca32 --- /dev/null +++ b/website_event_no_registration/views/view_event_type.xml @@ -0,0 +1,12 @@ + + + + event.type + + + + + + + +