diff --git a/event_website_hidden/__init__.py b/event_website_hidden/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/event_website_hidden/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/event_website_hidden/__manifest__.py b/event_website_hidden/__manifest__.py new file mode 100644 index 0000000..a4820ab --- /dev/null +++ b/event_website_hidden/__manifest__.py @@ -0,0 +1,37 @@ +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). +{ + "name": "Hidden website event", + "version": "1.0.0", + "summary": "This module adds the possibility to hide events on website.", + "description": """ +The events marked as unindexed on website don't appear on the website browser but can be acced with the event public link (direct share). + """, + "author": "RemiFr82", + "contributors": "", + "website": "https://remifr82.me", + "license": "LGPL-3", + "category": "Events", + # "price": 0, + # "currency": "EUR", + "application": False, + "installable": True, + "auto_install": False, + "pre_init_hook": "", + "post_init_hook": "", + "uninstall_hook": "", + "excludes": [], + "external_dependencies": [], + "depends": [ + "website_event", + ], + "data": [ + "views/event_event.xml", + ], + "assets": {}, + "css": [], + "images": [], + "js": [], + "test": [], + "demo": [], + "maintainer": "RemiFr82", +} diff --git a/event_website_hidden/i18n/fr.po b/event_website_hidden/i18n/fr.po new file mode 100644 index 0000000..6c59c64 --- /dev/null +++ b/event_website_hidden/i18n/fr.po @@ -0,0 +1,31 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * event_website_hidden +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0-20230613\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-08-07 21:30+0000\n" +"PO-Revision-Date: 2024-08-07 21:30+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: event_website_hidden +#: model:ir.model,name:event_website_hidden.model_event_event +msgid "Event" +msgstr "Événement" + +#. module: event_website_hidden +#: model:ir.model.fields,help:event_website_hidden.field_event_event__website_indexed +msgid "This event cannot be found by website suearch if unindexed." +msgstr "Cet évènement n'apparaîtra pas dans le recherche web s'il est désindexé." + +#. module: event_website_hidden +#: model:ir.model.fields,field_description:event_website_hidden.field_event_event__website_indexed +msgid "Indexed in website" +msgstr "Indexé sur le site web" diff --git a/event_website_hidden/models/__init__.py b/event_website_hidden/models/__init__.py new file mode 100644 index 0000000..b6bc389 --- /dev/null +++ b/event_website_hidden/models/__init__.py @@ -0,0 +1 @@ +from . import event_event diff --git a/event_website_hidden/models/event_event.py b/event_website_hidden/models/event_event.py new file mode 100644 index 0000000..660ba8a --- /dev/null +++ b/event_website_hidden/models/event_event.py @@ -0,0 +1,23 @@ +from odoo import models, fields, api + + +class EventEvent(models.Model): + _inherit = "event.event" + + website_indexed = fields.Boolean( + string="Indexed in website", + default=True, + help="This event cannot be found by website suearch if unindexed.", + ) + + @api.model + def _search_build_domain(self, domain_list, search, fields, extra=None): + if isinstance(domain_list, (list, tuple)): + if not any( + any(term[0] == "website_indexed" for term in domain) + for domain in domain_list + ): + domain_list.append([("website_indexed", "=", True)]) + else: + domain_list = [[("website_indexed", "=", True)]] + return super()._search_build_domain(domain_list, search, fields, extra) diff --git a/event_website_hidden/views/event_event.xml b/event_website_hidden/views/event_event.xml new file mode 100644 index 0000000..a1c1240 --- /dev/null +++ b/event_website_hidden/views/event_event.xml @@ -0,0 +1,19 @@ + + + + + event.event.view.form.inherit + event.event + + + + + + + + + +