Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
1b18f9d
[8.0][website_event_filter_selector] Filter events with selectors.
yajo Mar 23, 2016
5d08f6c
[IMP] website_event_filter_selector
pedrobaeza Apr 28, 2016
ad0e58f
[9.0][website_event_filter_selector] Migrate.
yajo Dec 19, 2016
822f826
[10.0][MIG][website_event_filter_selector]
yajo Jun 22, 2017
da59b8c
[MIG] website_event_filter_selector: Migration to 11.0
tarteo May 30, 2018
4cb19ba
[12.0][MIG] website_event_filter_selector
Mar 1, 2019
488f75c
[FIX] website_event_filter_selector: Update tour
yajo Apr 16, 2019
b824d9a
[UPD] Update website_event_filter_selector.pot
oca-travis Aug 20, 2019
e68e564
[IMP] website_event_filter_selector: simpler automatic width
Apr 23, 2020
9914bc3
[IMP] website_event_filter_selector: make prettier
Apr 24, 2020
d0f99a9
[IMP] website_event_filter_selector: black, isort, prettier
victoralmau Feb 26, 2021
2eeb5d9
[MIG] website_event_filter_selector: Migration to 13.0
victoralmau Feb 26, 2021
c228c22
[FIX] website_event_filter_selector: ignore events from other websites
Aug 3, 2021
b9ddc71
[IMP] website_event_filter_selector: maintain it
Aug 5, 2021
3d35a11
[IMP/FIX] website_event_filter_city: search input and refactor
chienandalu Mar 7, 2022
060724d
[IMP] website_event_filter_city: black, isort, prettier
chienandalu Mar 14, 2023
0677cfb
[MIG] website_event_filter_city: Migration to 15.0
chienandalu Apr 3, 2023
e099c93
[UPD] Update website_event_filter_city.pot
Apr 5, 2023
74503b0
[UPD] README.rst
OCA-git-bot Apr 5, 2023
978387b
Update translation files
weblate Apr 5, 2023
a7943be
Added translation using Weblate (Italian)
mymage Jul 18, 2023
e5b5ff0
Translated using Weblate (Italian)
mymage Jul 20, 2023
22e8221
Translated using Weblate (Italian)
mymage Jul 28, 2023
3ddce5d
[UPD] README.rst
OCA-git-bot Sep 3, 2023
4f1ae00
Update translation files
weblate Oct 9, 2023
fa404b3
Translated using Weblate (Spanish)
Ivorra78 Oct 29, 2023
7500f80
[IMP] website_event_filter_city: pre-commit auto fixes
pilarvargas-tecnativa Dec 9, 2024
3d42e5a
[MIG] website_event_filter_city: Migration to version 17.0
pilarvargas-tecnativa Dec 9, 2024
bc95de5
[UPD] Update website_event_filter_city.pot
Dec 11, 2024
2f31ae5
[BOT] post-merge updates
OCA-git-bot Dec 11, 2024
1aa8bfd
Update translation files
weblate Dec 11, 2024
cd7762d
Translated using Weblate (Italian)
mymage Dec 12, 2024
1699556
[FIX] website_event_filter_city: Country filter support
pilarvargas-tecnativa Dec 13, 2024
6890695
[BOT] post-merge updates
OCA-git-bot Dec 17, 2024
5415dee
[MIG] website_event_filter_city: Migration to 18.0
hbrunn Feb 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions website_event_filter_city/README.rst
Original file line number Diff line number Diff line change
@@ -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 </event>`__.
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 <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:%20website_event_filter_city%0Aversion:%2018.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
-------

* Antiun Ingeniería S.L.
* Tecnativa
* Onestein

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

- Dennis Sluijk <d.sluijk@onestein.nl>

- Cristina Martin R.

- `Tecnativa <https://www.tecnativa.com>`__:

- 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 <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-pilarvargas-tecnativa|

This module is part of the `OCA/event <https://github.com/OCA/event/tree/18.0/website_event_filter_city>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions website_event_filter_city/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from . import controllers, models
25 changes: 25 additions & 0 deletions website_event_filter_city/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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",
]
},
}
3 changes: 3 additions & 0 deletions website_event_filter_city/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from . import main
70 changes: 70 additions & 0 deletions website_event_filter_city/controllers/main.py
Original file line number Diff line number Diff line change
@@ -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
90 changes: 90 additions & 0 deletions website_event_filter_city/demo/tour_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2019 Tecnativa - Jairo Llopis
Copyright 2021 Tecnativa - Víctor Martínez
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). -->
<!-- Data required to run the tour without depending on upstream demo data -->
<data>
<record id="partner_barcelona" model="res.partner">
<field name="city">Barcelona</field>
<field name="country_id" ref="base.es" />
<field name="email">hotel.catala@example.com</field>
<field name="is_company" eval="True" />
<field name="name">Hotel Català</field>
<field name="street">Carrer Català</field>
</record>
<record id="partner_sevilla" model="res.partner">
<field name="city">Sevilla</field>
<field name="country_id" ref="base.es" />
<field name="email">hotel.aceite.jerez@example.com</field>
<field name="is_company" eval="True" />
<field name="name">Hotel Aceite de Jerez</field>
<field name="street">C/ Alquería</field>
</record>
<record id="event_type_code_sprint" model="event.tag">
<field name="name">Code Sprint</field>
<field name="sequence">30</field>
<field name="category_id" ref="event.event_tag_category_3" />
<field name="color">10</field>
</record>
<record id="event_type_breakfast" model="event.tag">
<field name="name">Breakfast</field>
<field name="sequence">40</field>
<field name="category_id" ref="event.event_tag_category_3" />
<field name="color">11</field>
</record>
<record id="event_barcelona" model="event.event">
<field name="address_id" ref="partner_barcelona" />
<field name="date_begin">2017-05-29 09:00:00</field>
<field name="date_end">2017-05-31 19:00:00</field>
<field
name="tag_ids"
eval="[(4, ref('website_event_filter_city.event_type_code_sprint'))]"
/>
<field name="name">Barcelona Days 2017</field>
<field name="seats_limited" eval="True" />
<field name="seats_max">500</field>
<field name="user_id" ref="base.user_admin" />
<field name="website_published" eval="True" />
</record>
<record id="event_sevilla_cs" model="event.event">
<field name="address_id" ref="partner_sevilla" />
<field name="date_begin">2018-06-11 09:00:00</field>
<field name="date_end">2018-06-13 19:00:00</field>
<field
name="tag_ids"
eval="[(4, ref('website_event_filter_city.event_type_code_sprint'))]"
/>
<field name="name">Sevilla Code Sprint 2018</field>
<field name="seats_limited" eval="True" />
<field name="seats_max">200</field>
<field name="user_id" ref="base.user_admin" />
<field name="website_published" eval="True" />
</record>
<record id="event_sevilla_bf" model="event.event">
<field name="address_id" ref="partner_sevilla" />
<field name="date_begin">2018-06-11 08:00:00</field>
<field name="date_end">2018-06-11 09:00:00</field>
<field
name="tag_ids"
eval="[(4, ref('website_event_filter_city.event_type_breakfast'))]"
/>
<field name="name">Sevilla Awesome Breakfast 2018</field>
<field name="seats_limited" eval="True" />
<field name="seats_max">10</field>
<field name="user_id" ref="base.user_admin" />
<field name="website_published" eval="True" />
</record>
<record id="event_online" model="event.event">
<field name="address_id" eval="False" />
<field name="date_begin">2018-04-18 09:00:00</field>
<field name="date_end">2018-04-20 19:00:00</field>
<field
name="tag_ids"
eval="[(4, ref('website_event_filter_city.event_type_breakfast'))]"
/>
<field name="name">Online Code Sprint 2018</field>
<field name="seats_limited" eval="False" />
<field name="user_id" ref="base.user_admin" />
<field name="website_published" eval="True" />
</record>
</data>
Loading