diff --git a/website_event_filter_city/README.rst b/website_event_filter_city/README.rst new file mode 100644 index 000000000..386b3af82 --- /dev/null +++ b/website_event_filter_city/README.rst @@ -0,0 +1,113 @@ +========================= +Website Event Filter City +========================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:7296c691779ed694e8a941d31176bdf165def621d7ba247d1ffda11b9b96336e + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fevent-lightgray.png?logo=github + :target: https://github.com/OCA/event/tree/18.0/website_event_filter_city + :alt: OCA/event +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/event-18-0/event-18-0-website_event_filter_city + :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=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends the functionality of the events website page to +support using filter events by city. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +To configure this module, you need to: + +1. Go to `your website events page `__. +2. Edit the event page with the web editor and in the *Customize* tab + activate/deactivate *Filter by City*. + +Known issues / Roadmap +====================== + +- You cannot run the tests unless you are in a bare database with demo + data. + +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 +------- + +* Antiun Ingeniería S.L. +* Tecnativa +* Onestein + +Contributors +------------ + +- Dennis Sluijk + +- Cristina Martin R. + +- `Tecnativa `__: + + - Rafael Blasco + - Pedro Baeza + - Jairo Llopis + - Víctor Martínez + - David Vidal + - 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. + +.. |maintainer-pilarvargas-tecnativa| image:: https://github.com/pilarvargas-tecnativa.png?size=40px + :target: https://github.com/pilarvargas-tecnativa + :alt: pilarvargas-tecnativa + +Current `maintainer `__: + +|maintainer-pilarvargas-tecnativa| + +This module is part of the `OCA/event `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/website_event_filter_city/__init__.py b/website_event_filter_city/__init__.py new file mode 100644 index 000000000..1269a4cb0 --- /dev/null +++ b/website_event_filter_city/__init__.py @@ -0,0 +1,3 @@ +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +from . import controllers, models diff --git a/website_event_filter_city/__manifest__.py b/website_event_filter_city/__manifest__.py new file mode 100644 index 000000000..720051f93 --- /dev/null +++ b/website_event_filter_city/__manifest__.py @@ -0,0 +1,25 @@ +# Copyright 2016-2017 Tecnativa - Jairo Llopis +# Copyright 2019 Tecnativa - Cristina Martin R. +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). +{ + "name": "Website Event Filter City", + "summary": "Add a customizable top area to filter events with city", + "version": "18.0.1.0.0", + "category": "Website", + "website": "https://github.com/OCA/event", + "author": "Antiun Ingeniería S.L., " + "Tecnativa, " + "Onestein, " + "Odoo Community Association (OCA)", + "maintainers": ["pilarvargas-tecnativa"], + "license": "LGPL-3", + "installable": True, + "depends": ["website_event"], + "data": ["templates/event.xml"], + "demo": ["demo/tour_data.xml"], + "assets": { + "web.assets_tests": [ + "/website_event_filter_city/static/src/js/*.js", + ] + }, +} diff --git a/website_event_filter_city/controllers/__init__.py b/website_event_filter_city/controllers/__init__.py new file mode 100644 index 000000000..6b7a5e0db --- /dev/null +++ b/website_event_filter_city/controllers/__init__.py @@ -0,0 +1,3 @@ +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +from . import main diff --git a/website_event_filter_city/controllers/main.py b/website_event_filter_city/controllers/main.py new file mode 100644 index 000000000..5a05a9d8a --- /dev/null +++ b/website_event_filter_city/controllers/main.py @@ -0,0 +1,70 @@ +# Copyright 2016-2017 Tecnativa - Jairo Llopis +# Copyright 2023 Tecnativa - David Vidal +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +from odoo import _ +from odoo.http import request, route + +from odoo.addons.website_event.controllers.main import WebsiteEventController + + +class WebsiteEvent(WebsiteEventController): + @route() + def events(self, page=1, **searches): + searches.setdefault("city", _("All Cities")) + # Inject our city in `_search_with_fuzzy` which ends up in `event.event` + # `_search_get_detail` override. + if searches["city"] != _("All Cities"): + request.website = request.website.with_context( + event_filter_city=searches["city"] + ) + response = super().events(page, **searches) + # We can avoid ugly mokeypatching using the domains that we get in return from + # the qcontext values, that are already injected with our city filters. This + # way we can easily make city filter compatible with the other filters. + qcontext = response.qcontext + # We can rely in this domain by default + domain = next( + ( + domain + for _, name, domain, _ in qcontext["dates"] + if name == qcontext["current_date"] + ), + qcontext["dates"][0][2], + ) + # This domain includes all the other filters + if qcontext["current_country"]: + domain = next( + country_domain["__domain"] + for country_domain in qcontext["countries"][1:] + if country_domain["country_id"] + and country_domain["country_id"][0] == qcontext["current_country"].id + ) + # Otherwise, we can make some domain surgery to reuse the domain country for + # our own purposes. + elif len(qcontext["countries"]) > 1: + domain = qcontext["countries"][1]["__domain"] + countries_domain = [ + "|", + ("country_id", "=", False), + ("country_id", "!=", False), + ] + country_tuple_index = next( + i for i, x in enumerate(domain) if len(x) > 1 and x[0] == "country_id" + ) + domain.pop(country_tuple_index) + domain[country_tuple_index : len(countries_domain)] = countries_domain + # Finally we can use the domain we obtained to filter the cities in the controls + cities = request.env["event.event"].read_group( + domain, ["city"], groupby="city", orderby="city" + ) + cities.insert( + 0, + { + "city_count": sum(x["city_count"] for x in cities), + "city": _("All Cities"), + }, + ) + qcontext["cities"] = cities + qcontext["current_city"] = searches["city"] + return response diff --git a/website_event_filter_city/demo/tour_data.xml b/website_event_filter_city/demo/tour_data.xml new file mode 100644 index 000000000..e21401f10 --- /dev/null +++ b/website_event_filter_city/demo/tour_data.xml @@ -0,0 +1,90 @@ + + + + + + Barcelona + + hotel.catala@example.com + + Hotel Català + Carrer Català + + + Sevilla + + hotel.aceite.jerez@example.com + + Hotel Aceite de Jerez + C/ Alquería + + + Code Sprint + 30 + + 10 + + + Breakfast + 40 + + 11 + + + + 2017-05-29 09:00:00 + 2017-05-31 19:00:00 + + Barcelona Days 2017 + + 500 + + + + + + 2018-06-11 09:00:00 + 2018-06-13 19:00:00 + + Sevilla Code Sprint 2018 + + 200 + + + + + + 2018-06-11 08:00:00 + 2018-06-11 09:00:00 + + Sevilla Awesome Breakfast 2018 + + 10 + + + + + + 2018-04-18 09:00:00 + 2018-04-20 19:00:00 + + Online Code Sprint 2018 + + + + + diff --git a/website_event_filter_city/i18n/de.po b/website_event_filter_city/i18n/de.po new file mode 100644 index 000000000..6b5aa953a --- /dev/null +++ b/website_event_filter_city/i18n/de.po @@ -0,0 +1,94 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_event_filter_selector +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-05-05 19:00+0000\n" +"PO-Revision-Date: 2016-05-05 19:00+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: website_event_filter_city +#. odoo-python +#: code:addons/website_event_filter_city/controllers/main.py:0 +#: model_terms:ir.ui.view,arch_db:website_event_filter_city.event_city +#, python-format +msgid "All Cities" +msgstr "Alle Städte" + +#. module: website_event_filter_city +#: model:event.event,name:website_event_filter_city.event_barcelona +msgid "Barcelona Days 2017" +msgstr "" + +#. module: website_event_filter_city +#: model:event.tag,name:website_event_filter_city.event_type_breakfast +msgid "Breakfast" +msgstr "" + +#. module: website_event_filter_city +#: model:ir.model.fields,field_description:website_event_filter_city.field_event_event__city +#: model_terms:ir.ui.view,arch_db:website_event_filter_city.event_city +msgid "City" +msgstr "Stadt" + +#. module: website_event_filter_city +#: model:event.tag,name:website_event_filter_city.event_type_code_sprint +msgid "Code Sprint" +msgstr "" + +#. module: website_event_filter_city +#: model:ir.model,name:website_event_filter_city.model_event_event +msgid "Event" +msgstr "Veranstaltung" + +#. module: website_event_filter_city +#: model_terms:event.event,description:website_event_filter_city.event_barcelona +#: model_terms:event.event,description:website_event_filter_city.event_online +#: model_terms:event.event,description:website_event_filter_city.event_sevilla_bf +#: model_terms:event.event,description:website_event_filter_city.event_sevilla_cs +msgid "" +"Every year we invite our community, partners and end-users to come and meet " +"us! It's the ideal event to get together and present new features, roadmap " +"of future versions, achievements of the software, workshops, training " +"sessions, etc...\n" +" This event is also an opportunity to showcase our partners' case " +"studies, methodology or developments. Be there and see directly from the " +"source the features of the new version!" +msgstr "" + +#. module: website_event_filter_city +#: model_terms:ir.ui.view,arch_db:website_event_filter_city.event_city +msgid "Filter by City" +msgstr "" + +#. module: website_event_filter_city +#: model_terms:event.event,description:website_event_filter_city.event_barcelona +#: model_terms:event.event,description:website_event_filter_city.event_online +#: model_terms:event.event,description:website_event_filter_city.event_sevilla_bf +#: model_terms:event.event,description:website_event_filter_city.event_sevilla_cs +msgid "Join us for this 24 hours Event" +msgstr "" + +#. module: website_event_filter_city +#: model:event.event,name:website_event_filter_city.event_online +msgid "Online Code Sprint 2018" +msgstr "" + +#. module: website_event_filter_city +#: model:event.event,name:website_event_filter_city.event_sevilla_bf +msgid "Sevilla Awesome Breakfast 2018" +msgstr "" + +#. module: website_event_filter_city +#: model:event.event,name:website_event_filter_city.event_sevilla_cs +msgid "Sevilla Code Sprint 2018" +msgstr "" diff --git a/website_event_filter_city/i18n/es.po b/website_event_filter_city/i18n/es.po new file mode 100644 index 000000000..74754c03f --- /dev/null +++ b/website_event_filter_city/i18n/es.po @@ -0,0 +1,122 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_event_filter_selector +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-05-05 19:00+0000\n" +"PO-Revision-Date: 2023-10-29 23:37+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: \n" +"Language: es\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: website_event_filter_city +#. odoo-python +#: code:addons/website_event_filter_city/controllers/main.py:0 +#: model_terms:ir.ui.view,arch_db:website_event_filter_city.event_city +#, python-format +msgid "All Cities" +msgstr "Todas las poblaciones" + +#. module: website_event_filter_city +#: model:event.event,name:website_event_filter_city.event_barcelona +msgid "Barcelona Days 2017" +msgstr "Días de Barcelona 2017" + +#. module: website_event_filter_city +#: model:event.tag,name:website_event_filter_city.event_type_breakfast +msgid "Breakfast" +msgstr "Desayuno" + +#. module: website_event_filter_city +#: model:ir.model.fields,field_description:website_event_filter_city.field_event_event__city +#: model_terms:ir.ui.view,arch_db:website_event_filter_city.event_city +msgid "City" +msgstr "Población" + +#. module: website_event_filter_city +#: model:event.tag,name:website_event_filter_city.event_type_code_sprint +msgid "Code Sprint" +msgstr "Carrera de Código" + +#. module: website_event_filter_city +#: model:ir.model,name:website_event_filter_city.model_event_event +msgid "Event" +msgstr "Evento" + +#. module: website_event_filter_city +#: model_terms:event.event,description:website_event_filter_city.event_barcelona +#: model_terms:event.event,description:website_event_filter_city.event_online +#: model_terms:event.event,description:website_event_filter_city.event_sevilla_bf +#: model_terms:event.event,description:website_event_filter_city.event_sevilla_cs +msgid "" +"Every year we invite our community, partners and end-users to come and meet " +"us! It's the ideal event to get together and present new features, roadmap " +"of future versions, achievements of the software, workshops, training " +"sessions, etc...\n" +" This event is also an opportunity to showcase our partners' case " +"studies, methodology or developments. Be there and see directly from the " +"source the features of the new version!" +msgstr "" + +#. module: website_event_filter_city +#: model_terms:ir.ui.view,arch_db:website_event_filter_city.event_city +msgid "Filter by City" +msgstr "" + +#. module: website_event_filter_city +#: model_terms:event.event,description:website_event_filter_city.event_barcelona +#: model_terms:event.event,description:website_event_filter_city.event_online +#: model_terms:event.event,description:website_event_filter_city.event_sevilla_bf +#: model_terms:event.event,description:website_event_filter_city.event_sevilla_cs +msgid "Join us for this 24 hours Event" +msgstr "Únase a nosotros en este Evento de 24 horas" + +#. module: website_event_filter_city +#: model:event.event,name:website_event_filter_city.event_online +msgid "Online Code Sprint 2018" +msgstr "Sprint de código en línea 2018" + +#. module: website_event_filter_city +#: model:event.event,name:website_event_filter_city.event_sevilla_bf +msgid "Sevilla Awesome Breakfast 2018" +msgstr "Desayuno Impresionante de Sevilla 2018" + +#. module: website_event_filter_city +#: model:event.event,name:website_event_filter_city.event_sevilla_cs +msgid "Sevilla Code Sprint 2018" +msgstr "Código Sevilla Sprint 2018" + +#~ msgid "Blocked" +#~ msgstr "Bloqueado" + +#~ msgid "" +#~ "Every year we invite our community, partners and end-users to come and " +#~ "meet us! It's the ideal event to get together and present new features, " +#~ "roadmap of future versions, achievements of the software, workshops, " +#~ "training sessions, etc....\n" +#~ " This event is also an opportunity to showcase our partners' " +#~ "case studies, methodology or developments. Be there and see directly from " +#~ "the source the features of the new version!" +#~ msgstr "" +#~ "Todos los años invitamos a nuestra comunidad, socios y usuarios finales a " +#~ "reunirse con nosotros. Es el evento ideal para reunirnos y presentar las " +#~ "nuevas funcionalidades, la hoja de ruta de futuras versiones, los logros " +#~ "del software, talleres, sesiones de formación, etc.....\n" +#~ " Este evento es también una oportunidad para mostrar los " +#~ "estudios de casos, la metodología o los desarrollos de nuestros socios." +#~ "¡ Asista y vea directamente desde la fuente las características de la " +#~ "nueva versión!" + +#~ msgid "In Progress" +#~ msgstr "En Curso" + +#~ msgid "Ready for Next Stage" +#~ msgstr "Listo para la Siguiente Etapa" diff --git a/website_event_filter_city/i18n/it.po b/website_event_filter_city/i18n/it.po new file mode 100644 index 000000000..ac3b94209 --- /dev/null +++ b/website_event_filter_city/i18n/it.po @@ -0,0 +1,127 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_event_filter_city +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-12-12 10:06+0000\n" +"Last-Translator: mymage \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 5.6.2\n" + +#. module: website_event_filter_city +#. odoo-python +#: code:addons/website_event_filter_city/controllers/main.py:0 +#: model_terms:ir.ui.view,arch_db:website_event_filter_city.event_city +#, python-format +msgid "All Cities" +msgstr "Tutte le città" + +#. module: website_event_filter_city +#: model:event.event,name:website_event_filter_city.event_barcelona +msgid "Barcelona Days 2017" +msgstr "Barcellona days 2017" + +#. module: website_event_filter_city +#: model:event.tag,name:website_event_filter_city.event_type_breakfast +msgid "Breakfast" +msgstr "Colazione" + +#. module: website_event_filter_city +#: model:ir.model.fields,field_description:website_event_filter_city.field_event_event__city +#: model_terms:ir.ui.view,arch_db:website_event_filter_city.event_city +msgid "City" +msgstr "Città" + +#. module: website_event_filter_city +#: model:event.tag,name:website_event_filter_city.event_type_code_sprint +msgid "Code Sprint" +msgstr "Code sprint" + +#. module: website_event_filter_city +#: model:ir.model,name:website_event_filter_city.model_event_event +msgid "Event" +msgstr "Evento" + +#. module: website_event_filter_city +#: model_terms:event.event,description:website_event_filter_city.event_barcelona +#: model_terms:event.event,description:website_event_filter_city.event_online +#: model_terms:event.event,description:website_event_filter_city.event_sevilla_bf +#: model_terms:event.event,description:website_event_filter_city.event_sevilla_cs +msgid "" +"Every year we invite our community, partners and end-users to come and meet " +"us! It's the ideal event to get together and present new features, roadmap " +"of future versions, achievements of the software, workshops, training " +"sessions, etc...\n" +" This event is also an opportunity to showcase our partners' case " +"studies, methodology or developments. Be there and see directly from the " +"source the features of the new version!" +msgstr "" +"Ogni anno invitiamo la nostra comunità, i partner e gli utenti finali ad " +"incontrarci! È l'evento ideale per stare insieme presentare le nuove " +"funzionalità, i percorsi delle versioni future, i risultati del software, " +"workshop, sessioni di addestramento, ecc...\n" +" Questo evento inoltre è un'opportunità per mostrare i casi " +"studio dei nostri partner, la metodologia o lo sviluppo. Partecipa e vedi " +"direttamente dalla fonte le caratteristiche della nuova versione!" + +#. module: website_event_filter_city +#: model_terms:ir.ui.view,arch_db:website_event_filter_city.event_city +msgid "Filter by City" +msgstr "Filtro per città" + +#. module: website_event_filter_city +#: model_terms:event.event,description:website_event_filter_city.event_barcelona +#: model_terms:event.event,description:website_event_filter_city.event_online +#: model_terms:event.event,description:website_event_filter_city.event_sevilla_bf +#: model_terms:event.event,description:website_event_filter_city.event_sevilla_cs +msgid "Join us for this 24 hours Event" +msgstr "Unisciti a noi per questo evento di 24 ore" + +#. module: website_event_filter_city +#: model:event.event,name:website_event_filter_city.event_online +msgid "Online Code Sprint 2018" +msgstr "Code sprint online 2018" + +#. module: website_event_filter_city +#: model:event.event,name:website_event_filter_city.event_sevilla_bf +msgid "Sevilla Awesome Breakfast 2018" +msgstr "Awesome Breakfast Siviglia 2018" + +#. module: website_event_filter_city +#: model:event.event,name:website_event_filter_city.event_sevilla_cs +msgid "Sevilla Code Sprint 2018" +msgstr "Code sprint Siviglia 2018" + +#~ msgid "Blocked" +#~ msgstr "Bloccato" + +#~ msgid "" +#~ "Every year we invite our community, partners and end-users to come and " +#~ "meet us! It's the ideal event to get together and present new features, " +#~ "roadmap of future versions, achievements of the software, workshops, " +#~ "training sessions, etc....\n" +#~ " This event is also an opportunity to showcase our partners' " +#~ "case studies, methodology or developments. Be there and see directly from " +#~ "the source the features of the new version!" +#~ msgstr "" +#~ "Ogni anno invitiamo la nostra comunità, i partner e gli utenti finali ad " +#~ "incontrarci! È l'evento ideale per stare insieme presentare nuove " +#~ "funzionalità, i percorsi delle versioni future, i risultati del software, " +#~ "workshop, sessioni di addestramento, ecc...\n" +#~ " Questo evento inoltre è un'opportunità per mostrare i casi " +#~ "studio dei nostri partner, la metodologia o lo sviluppo. Partecipa e vedi " +#~ "direttamente dalla fonte le caratteristiche della nuova versione!" + +#~ msgid "In Progress" +#~ msgstr "In corso" + +#~ msgid "Ready for Next Stage" +#~ msgstr "Pronto per la prossima fase" diff --git a/website_event_filter_city/i18n/website_event_filter_city.pot b/website_event_filter_city/i18n/website_event_filter_city.pot new file mode 100644 index 000000000..f11fbf64a --- /dev/null +++ b/website_event_filter_city/i18n/website_event_filter_city.pot @@ -0,0 +1,88 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_event_filter_city +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.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: website_event_filter_city +#. odoo-python +#: code:addons/website_event_filter_city/controllers/main.py:0 +#: code:addons/website_event_filter_city/controllers/main.py:0 +#: code:addons/website_event_filter_city/controllers/main.py:0 +#: model_terms:ir.ui.view,arch_db:website_event_filter_city.event_city +#, python-format +msgid "All Cities" +msgstr "" + +#. module: website_event_filter_city +#: model:event.event,name:website_event_filter_city.event_barcelona +msgid "Barcelona Days 2017" +msgstr "" + +#. module: website_event_filter_city +#: model:event.tag,name:website_event_filter_city.event_type_breakfast +msgid "Breakfast" +msgstr "" + +#. module: website_event_filter_city +#: model:ir.model.fields,field_description:website_event_filter_city.field_event_event__city +#: model_terms:ir.ui.view,arch_db:website_event_filter_city.event_city +msgid "City" +msgstr "" + +#. module: website_event_filter_city +#: model:event.tag,name:website_event_filter_city.event_type_code_sprint +msgid "Code Sprint" +msgstr "" + +#. module: website_event_filter_city +#: model:ir.model,name:website_event_filter_city.model_event_event +msgid "Event" +msgstr "" + +#. module: website_event_filter_city +#: model_terms:event.event,description:website_event_filter_city.event_barcelona +#: model_terms:event.event,description:website_event_filter_city.event_online +#: model_terms:event.event,description:website_event_filter_city.event_sevilla_bf +#: model_terms:event.event,description:website_event_filter_city.event_sevilla_cs +msgid "" +"Every year we invite our community, partners and end-users to come and meet us! It's the ideal event to get together and present new features, roadmap of future versions, achievements of the software, workshops, training sessions, etc...\n" +" This event is also an opportunity to showcase our partners' case studies, methodology or developments. Be there and see directly from the source the features of the new version!" +msgstr "" + +#. module: website_event_filter_city +#: model_terms:ir.ui.view,arch_db:website_event_filter_city.event_city +msgid "Filter by City" +msgstr "" + +#. module: website_event_filter_city +#: model_terms:event.event,description:website_event_filter_city.event_barcelona +#: model_terms:event.event,description:website_event_filter_city.event_online +#: model_terms:event.event,description:website_event_filter_city.event_sevilla_bf +#: model_terms:event.event,description:website_event_filter_city.event_sevilla_cs +msgid "Join us for this 24 hours Event" +msgstr "" + +#. module: website_event_filter_city +#: model:event.event,name:website_event_filter_city.event_online +msgid "Online Code Sprint 2018" +msgstr "" + +#. module: website_event_filter_city +#: model:event.event,name:website_event_filter_city.event_sevilla_bf +msgid "Sevilla Awesome Breakfast 2018" +msgstr "" + +#. module: website_event_filter_city +#: model:event.event,name:website_event_filter_city.event_sevilla_cs +msgid "Sevilla Code Sprint 2018" +msgstr "" diff --git a/website_event_filter_city/models/__init__.py b/website_event_filter_city/models/__init__.py new file mode 100644 index 000000000..f199597d1 --- /dev/null +++ b/website_event_filter_city/models/__init__.py @@ -0,0 +1,3 @@ +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +from . import event diff --git a/website_event_filter_city/models/event.py b/website_event_filter_city/models/event.py new file mode 100644 index 000000000..424c17973 --- /dev/null +++ b/website_event_filter_city/models/event.py @@ -0,0 +1,24 @@ +# Copyright 2016-2017 Tecnativa - Jairo Llopis +# Copyright 2023 Tecnativa - David Vidal +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). +from odoo import api, fields, models + + +class EventEvent(models.Model): + _inherit = "event.event" + + city = fields.Char(related="address_id.city") + + @api.model + def _search_get_detail(self, website, order, options): + """Override the original method injecting our city filters""" + city = self.env.context.get("event_filter_city") + res = super()._search_get_detail(website, order, options) + if city: + city_domain = [("city", "=", city)] + res.update(no_city_domain=res["base_domain"]) + res["base_domain"].append(city_domain) + res["no_country_domain"].append(city_domain) + res["no_date_domain"].append(city_domain) + self = self.with_context(helloo="Hi there!") + return res diff --git a/website_event_filter_city/pyproject.toml b/website_event_filter_city/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/website_event_filter_city/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/website_event_filter_city/readme/CONFIGURE.md b/website_event_filter_city/readme/CONFIGURE.md new file mode 100644 index 000000000..3cba35f2f --- /dev/null +++ b/website_event_filter_city/readme/CONFIGURE.md @@ -0,0 +1,5 @@ +To configure this module, you need to: + +1. Go to [your website events page](/event). +2. Edit the event page with the web editor and in the *Customize* tab + activate/deactivate *Filter by City*. diff --git a/website_event_filter_city/readme/CONTRIBUTORS.md b/website_event_filter_city/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..b6463e211 --- /dev/null +++ b/website_event_filter_city/readme/CONTRIBUTORS.md @@ -0,0 +1,12 @@ +- Dennis Sluijk \<\> + +- Cristina Martin R. + +- [Tecnativa](https://www.tecnativa.com): + + > - Rafael Blasco + > - Pedro Baeza + > - Jairo Llopis + > - Víctor Martínez + > - David Vidal + > - Pilar Vargas diff --git a/website_event_filter_city/readme/DESCRIPTION.md b/website_event_filter_city/readme/DESCRIPTION.md new file mode 100644 index 000000000..50afc5dfd --- /dev/null +++ b/website_event_filter_city/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +This module extends the functionality of the events website page to +support using filter events by city. diff --git a/website_event_filter_city/readme/ROADMAP.md b/website_event_filter_city/readme/ROADMAP.md new file mode 100644 index 000000000..2b857f0c0 --- /dev/null +++ b/website_event_filter_city/readme/ROADMAP.md @@ -0,0 +1,2 @@ +- You cannot run the tests unless you are in a bare database with demo + data. diff --git a/website_event_filter_city/static/description/all.png b/website_event_filter_city/static/description/all.png new file mode 100644 index 000000000..1a5cadc50 Binary files /dev/null and b/website_event_filter_city/static/description/all.png differ diff --git a/website_event_filter_city/static/description/icon.png b/website_event_filter_city/static/description/icon.png new file mode 100644 index 000000000..a1853ba6e Binary files /dev/null and b/website_event_filter_city/static/description/icon.png differ diff --git a/website_event_filter_city/static/description/index.html b/website_event_filter_city/static/description/index.html new file mode 100644 index 000000000..baae9bf77 --- /dev/null +++ b/website_event_filter_city/static/description/index.html @@ -0,0 +1,461 @@ + + + + + +Website Event Filter City + + + +
+

Website Event Filter City

+ + +

Beta License: LGPL-3 OCA/event Translate me on Weblate Try me on Runboat

+

This module extends the functionality of the events website page to +support using filter events by city.

+

Table of contents

+ +
+

Configuration

+

To configure this module, you need to:

+
    +
  1. Go to your website events page.
  2. +
  3. Edit the event page with the web editor and in the Customize tab +activate/deactivate Filter by City.
  4. +
+
+
+

Known issues / Roadmap

+
    +
  • You cannot run the tests unless you are in a bare database with demo +data.
  • +
+
+
+

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

+
    +
  • Antiun Ingeniería S.L.
  • +
  • Tecnativa
  • +
  • Onestein
  • +
+
+
+

Contributors

+
    +
  • Dennis Sluijk <d.sluijk@onestein.nl>

    +
  • +
  • Cristina Martin R.

    +
  • +
  • Tecnativa:

    +
    +
      +
    • Rafael Blasco
    • +
    • Pedro Baeza
    • +
    • Jairo Llopis
    • +
    • Víctor Martínez
    • +
    • David Vidal
    • +
    • Pilar Vargas
    • +
    +
    +
  • +
+
+
+

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:

+

pilarvargas-tecnativa

+

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

+

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

+
+
+
+ + diff --git a/website_event_filter_city/static/src/js/website_event_filter_city_tour.esm.js b/website_event_filter_city/static/src/js/website_event_filter_city_tour.esm.js new file mode 100644 index 000000000..cb21273fc --- /dev/null +++ b/website_event_filter_city/static/src/js/website_event_filter_city_tour.esm.js @@ -0,0 +1,87 @@ +/* Copyright 2016-2017 Tecnativa - Jairo Llopis + * Copyright 2021 Tecnativa - Víctor Martínez + * Copyright 2023 Tecnativa - David Vidal + * License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */ +import {registry} from "@web/core/registry"; + +registry.category("web_tour.tours").add("website_event_filter_city", { + test: true, + url: "/event", + steps: () => [ + { + trigger: "a.dropdown-toggle:contains('Upcoming')", + run: "click", + }, + { + trigger: "a.dropdown-item:contains('Past Events')", + run: "click", + }, + { + trigger: "a.dropdown-toggle:contains('Past Events')", + }, + { + trigger: "a.dropdown-toggle:contains('All countries')", + }, + { + trigger: + "#o_wevent_index_main_col h5 span:not(:contains('Barcelona Days 2017'))" + + ":contains('Online Code Sprint 2018')" + + ":not(:contains('Sevilla Code Sprint 2018'))" + + ":not(:contains('Sevilla Code Awesome Breakfast'))", + }, + { + trigger: "a.dropdown-toggle:contains('All countries')", + run: "click", + }, + { + trigger: "a.dropdown-item:contains('Spain')", + run: "click", + }, + { + trigger: "a.dropdown-toggle:contains('Spain')", + }, + { + trigger: + "#o_wevent_index_main_col:contains('Barcelona Days 2017')" + + ":contains('Sevilla Code Sprint 2018')" + + ":contains('Sevilla Awesome Breakfast 2018')", + }, + { + trigger: "a.dropdown-toggle:contains('All Cities')", + run: "click", + }, + { + trigger: "a.dropdown-item:contains('Sevilla')", + run: "click", + }, + { + trigger: "a.dropdown-toggle:contains('Sevilla')", + }, + { + trigger: "a.dropdown-toggle:contains('Type')", + run: "click", + }, + { + trigger: "span.dropdown-item:contains('Code Sprint')", + run: "click", + }, + { + trigger: + "#o_wevent_index_main_col:not(:contains('Barcelona Days 2017'))" + + ":not(:contains('Online Code Sprint 2018'))" + + ":contains('Sevilla Code Sprint 2018')" + + ":contains('Sevilla Awesome Breakfast 2018')", + }, + { + trigger: "a:contains('Sevilla Code Sprint 2018')", + run: "click", + }, + { + trigger: + "#o_wevent_index_main_col:not(:contains('Barcelona Days 2017'))" + + ":not(:contains('Online Code Sprint 2018'))" + + ":contains('Sevilla Code Sprint 2018')" + + ":not(:contains('Sevilla Awesome Breakfast 2018'))", + }, + ], +}); diff --git a/website_event_filter_city/templates/event.xml b/website_event_filter_city/templates/event.xml new file mode 100644 index 000000000..7e650b59a --- /dev/null +++ b/website_event_filter_city/templates/event.xml @@ -0,0 +1,109 @@ + + + + + diff --git a/website_event_filter_city/tests/__init__.py b/website_event_filter_city/tests/__init__.py new file mode 100644 index 000000000..bd4c3fc67 --- /dev/null +++ b/website_event_filter_city/tests/__init__.py @@ -0,0 +1,3 @@ +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +from . import test_ui diff --git a/website_event_filter_city/tests/test_ui.py b/website_event_filter_city/tests/test_ui.py new file mode 100644 index 000000000..c72ec6636 --- /dev/null +++ b/website_event_filter_city/tests/test_ui.py @@ -0,0 +1,21 @@ +# Copyright 2016 Tecnativa - Jairo Llopis +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +from odoo.tests.common import HttpCase, tagged + + +@tagged("post_install", "-at_install") +class UICase(HttpCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + websites = cls.env["website"].search([]) + # Activate country filters in all websites + for website in websites: + cls.env.ref("website_event.event_location").with_context( + website_id=website.id + ).active = True + + def test_ui_website(self): + """Test frontend tour.""" + self.start_tour("/event", "website_event_filter_city", login="portal")