Skip to content

Commit

Permalink
Merge dba32ea into e014694
Browse files Browse the repository at this point in the history
  • Loading branch information
sergio-teruel committed Apr 19, 2019
2 parents e014694 + dba32ea commit 76e70ca
Show file tree
Hide file tree
Showing 21 changed files with 1,030 additions and 0 deletions.
83 changes: 83 additions & 0 deletions website_event_filter_organizer/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
==============================
Website Event Filter Organizer
==============================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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/11.0/website_event_filter_organizer
:alt: OCA/event
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/event-11-0/event-11-0-website_event_filter_organizer
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/199/11.0
:alt: Try me on Runbot

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

This module extends the functionality of *website_event* module to allow you
to filter events by organizer into main events page.

**Table of contents**

.. contents::
:local:

Usage
=====

To use filter by organizer in website event page you should activate the
filter in customize options.

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 smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/event/issues/new?body=module:%20website_event_filter_organizer%0Aversion:%2011.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>`_:

* Sergio Teruel
* Carlos Dauden

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/11.0/website_event_filter_organizer>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
5 changes: 5 additions & 0 deletions website_event_filter_organizer/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2019 Tecnativa - Sergio Teruel
# Copyright 2019 Tecnativa - Carlos Dauden
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from . import controllers
22 changes: 22 additions & 0 deletions website_event_filter_organizer/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2019 Tecnativa - Sergio Teruel
# Copyright 2019 Tecnativa - Carlos Dauden
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

{
'name': 'Website Event Filter Organizer',
'summary': 'Filter events by organizer in frontend',
'version': '12.0.1.0.0',
'category': "event",
'author': 'Tecnativa, '
'Odoo Community Association (OCA)',
'license': 'AGPL-3',
'website': 'https://github.com/OCA/event',
'depends': ['website_event'],
'data': [
'views/website_event.xml',
],
'demo': [
'demo/assets.xml',
],
'installable': True,
}
5 changes: 5 additions & 0 deletions website_event_filter_organizer/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2019 Tecnativa - Sergio Teruel
# Copyright 2019 Tecnativa - Carlos Dauden
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from . import main
61 changes: 61 additions & 0 deletions website_event_filter_organizer/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Copyright 2019 Tecnativa - Sergio Teruel
# Copyright 2019 Tecnativa - Carlos Dauden
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from odoo import _, http
from odoo.http import request
from odoo.addons.website_event.controllers.main import WebsiteEventController


class WebsiteEventOrganizer(WebsiteEventController):

@http.route(
['/event', '/event/page/<int:page>'],
type='http', auth="public", website=True)
def events(self, page=1, **searches):
response = super(WebsiteEventOrganizer, self).events(page, **searches)
current_organizer = None

searches.update(response.qcontext['searches'])
searches.setdefault('organizer', 'all')

event_obj = request.env['event.event']
events = response.qcontext['event_ids']

organizers = event_obj.read_group(
[('id', 'in', events.ids)], ['organizer_id'], 'organizer_id')
organizers.insert(0, {
'organizer_id_count': len(events),
'organizer_id': ("all", _("All Organizers"))
})

if searches['organizer'] != 'all':
events = events.filtered(
lambda x: x.organizer_id.id == int(searches["organizer"]))
current_organizer = \
events and events[0].sudo().organizer_id.name or ''

step = 10 # events per page
pager = request.website.pager(
url="/event",
url_args={
'date': searches.get('date'),
'type': searches.get('type'),
'country': searches.get('country'),
'organizer': searches.get('organizer'),
},
total=len(events),
page=page,
step=step,
scope=5)
offset = response.qcontext['pager']['offset']
events = events[offset:offset+step]

response.qcontext.update({
'current_organizer': current_organizer,
'organizers': organizers,
'event_ids': events,
'searches': searches,
'pager': pager,
})
return response
10 changes: 10 additions & 0 deletions website_event_filter_organizer/demo/assets.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<template id="assets_frontend" name="website_event_filter_organizer assets" inherit_id="web.assets_frontend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/website_event_filter_organizer/static/src/js/tour.js"></script>
</xpath>
</template>
</data>
</odoo>
44 changes: 44 additions & 0 deletions website_event_filter_organizer/i18n/de.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_event_filter_organizer
#
# Translators:
# Rudolf Schnapka <rs@techno-flex.de>, 2016
msgid ""
msgstr ""
"Project-Id-Version: website (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-02-25 14:25+0000\n"
"PO-Revision-Date: 2016-02-23 13:58+0000\n"
"Last-Translator: Rudolf Schnapka <rs@techno-flex.de>\n"
"Language-Team: German (http://www.transifex.com/oca/OCA-website-8-0/language/"
"de/)\n"
"Language: de\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"

#. module: website_event_filter_organizer
#: view:website:website_event.index
msgid ""
"/event?{{ keep_query('country', 'date', 'organizer', type=type['type'][0]) }}"
msgstr ""

#. module: website_event_filter_organizer
#: view:website:website_event.index
msgid "/event?{{ keep_query('country', 'type', 'organizer', date=date[0]) }}"
msgstr ""

#. module: website_event_filter_organizer
#: view:website:website_event.index
msgid ""
"/event?{{ keep_query('date', 'type', 'organizer', "
"country=country['country_id'][0]) }}"
msgstr ""

#. module: website_event_filter_organizer
#: code:addons/website_event_filter_organizer/controllers/main.py:32
#, python-format
msgid "All Organizers"
msgstr "Alle Organizer"
47 changes: 47 additions & 0 deletions website_event_filter_organizer/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_event_filter_organizer
#
# Translators:
# Carles Antolí <carlesantoli@hotmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: website (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-03-12 02:17+0000\n"
"PO-Revision-Date: 2016-03-06 10:10+0000\n"
"Last-Translator: Carles Antolí <carlesantoli@hotmail.com>\n"
"Language-Team: Spanish (http://www.transifex.com/oca/OCA-website-8-0/"
"language/es/)\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"

#. module: website_event_filter_organizer
#: view:website:website_event.index
msgid ""
"/event?{{ keep_query('country', 'date', 'organizer', type=type['type'][0]) }}"
msgstr ""
"/event?{{ keep_query('country', 'date', 'organizer', type=type['type'][0]) }}"

#. module: website_event_filter_organizer
#: view:website:website_event.index
msgid "/event?{{ keep_query('country', 'type', 'organizer', date=date[0]) }}"
msgstr "/event?{{ keep_query('country', 'type', 'organizer', date=date[0]) }}"

#. module: website_event_filter_organizer
#: view:website:website_event.index
msgid ""
"/event?{{ keep_query('date', 'type', 'organizer', "
"country=country['country_id'][0]) }}"
msgstr ""
"/event?{{ keep_query('date', 'type', 'organizer', "
"country=country['country_id'][0]) }}"

#. module: website_event_filter_organizer
#: code:addons/website_event_filter_organizer/controllers/main.py:32
#, python-format
msgid "All Organizers"
msgstr "Todos los organizadores"
48 changes: 48 additions & 0 deletions website_event_filter_organizer/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_event_filter_organizer
#
# Translators:
# Paolo Valier, 2016
# Paolo Valier, 2016
msgid ""
msgstr ""
"Project-Id-Version: website (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-04-14 08:43+0000\n"
"PO-Revision-Date: 2016-04-27 19:55+0000\n"
"Last-Translator: Paolo Valier\n"
"Language-Team: Italian (http://www.transifex.com/oca/OCA-website-8-0/"
"language/it/)\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"

#. module: website_event_filter_organizer
#: view:website:website_event.index
msgid ""
"/event?{{ keep_query('country', 'date', 'organizer', type=type['type'][0]) }}"
msgstr ""
"/event?{{ keep_query('country', 'date', 'organizer', type=type['type'][0]) }}"

#. module: website_event_filter_organizer
#: view:website:website_event.index
msgid "/event?{{ keep_query('country', 'type', 'organizer', date=date[0]) }}"
msgstr "/event?{{ keep_query('country', 'type', 'organizer', date=date[0]) }}"

#. module: website_event_filter_organizer
#: view:website:website_event.index
msgid ""
"/event?{{ keep_query('date', 'type', 'organizer', "
"country=country['country_id'][0]) }}"
msgstr ""
"/event?{{ keep_query('date', 'type', 'organizer', "
"country=country['country_id'][0]) }}"

#. module: website_event_filter_organizer
#: code:addons/website_event_filter_organizer/controllers/main.py:32
#, python-format
msgid "All Organizers"
msgstr "Tutti gli Organizzatori"
44 changes: 44 additions & 0 deletions website_event_filter_organizer/i18n/pt_BR.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_event_filter_organizer
#
# Translators:
# danimaribeiro <danimaribeiro@gmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: website (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-03-12 02:17+0000\n"
"PO-Revision-Date: 2016-03-05 18:09+0000\n"
"Last-Translator: danimaribeiro <danimaribeiro@gmail.com>\n"
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-"
"website-8-0/language/pt_BR/)\n"
"Language: pt_BR\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"

#. module: website_event_filter_organizer
#: view:website:website_event.index
msgid ""
"/event?{{ keep_query('country', 'date', 'organizer', type=type['type'][0]) }}"
msgstr ""

#. module: website_event_filter_organizer
#: view:website:website_event.index
msgid "/event?{{ keep_query('country', 'type', 'organizer', date=date[0]) }}"
msgstr ""

#. module: website_event_filter_organizer
#: view:website:website_event.index
msgid ""
"/event?{{ keep_query('date', 'type', 'organizer', "
"country=country['country_id'][0]) }}"
msgstr ""

#. module: website_event_filter_organizer
#: code:addons/website_event_filter_organizer/controllers/main.py:32
#, python-format
msgid "All Organizers"
msgstr "Todos os organizadores"
Loading

0 comments on commit 76e70ca

Please sign in to comment.