Skip to content

Commit

Permalink
Merge 9a06e0d into 44ecc36
Browse files Browse the repository at this point in the history
  • Loading branch information
chienandalu committed Mar 29, 2019
2 parents 44ecc36 + 9a06e0d commit 6bf874f
Show file tree
Hide file tree
Showing 17 changed files with 772 additions and 0 deletions.
98 changes: 98 additions & 0 deletions website_event_require_login/README.rst
@@ -0,0 +1,98 @@
===========================
Website Event Require Login
===========================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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/10.0/website_event_require_login
:alt: OCA/event
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/event-10-0/event-10-0-website_event_require_login
: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/10.0
:alt: Try me on Runbot

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

Require login for event registration from the website.

**Table of contents**

.. contents::
:local:

Configuration
=============

To configure this module, you need to:

#. Go to an event and set the Website Require option on.

Usage
=====

In the website go to an event that requieres login and try to register being
logged out.

If the event is set up to require login, a pop up will be shown requiring the
user to do so.

Known issues / Roadmap
======================

* An interesting option could be to be able to hide events to unregistered
users.


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_require_login%0Aversion:%2010.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>`_:
* David Vidal
* Rafael Blasco

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/10.0/website_event_require_login>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions website_event_require_login/__init__.py
@@ -0,0 +1,2 @@
from . import controllers
from . import models
20 changes: 20 additions & 0 deletions website_event_require_login/__manifest__.py
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Copyright 2019 Tecnativa - David Vidal
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Website Event Require Login',
'version': '10.0.1.0.0',
'author': 'Tecnativa, '
'Odoo Community Association (OCA)',
'website': 'https://github.com/OCA/event',
'category': 'Event',
'depends': [
'website_event',
],
'data': [
'views/event_views.xml',
'views/website_event_templates.xml',
],
'installable': True,
'license': 'AGPL-3',
}
1 change: 1 addition & 0 deletions website_event_require_login/controllers/__init__.py
@@ -0,0 +1 @@
from . import main
21 changes: 21 additions & 0 deletions website_event_require_login/controllers/main.py
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Copyright 2019 Tecnativa - David Vidal
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

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


class RequireLoginToRegister(WebsiteEventController):

@route()
def registration_new(self, event, **post):
public_user = request.env.user == request.website.user_id
if public_user and event.website_require_login:
return request.env['ir.ui.view'].render_template(
'website_event_require_login'
'.modal_attendees_registration_login_required', {
'event_url': event.website_url,
})
return super(
RequireLoginToRegister, self).registration_new(event, **post)
57 changes: 57 additions & 0 deletions website_event_require_login/i18n/es.po
@@ -0,0 +1,57 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_event_require_login
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-03-19 12:00+0000\n"
"PO-Revision-Date: 2019-03-19 12:00+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_require_login
#: model:ir.ui.view,arch_db:website_event_require_login.modal_attendees_registration_login_required
msgid "&amp;times;"
msgstr "&amp;times;"

#. module: website_event_require_login
#: model:ir.ui.view,arch_db:website_event_require_login.modal_attendees_registration_login_required
msgid "Close"
msgstr "Cerrar"

#. module: website_event_require_login
#: model:ir.model,name:website_event_require_login.model_event_event
msgid "Event"
msgstr "Evento"

#. module: website_event_require_login
#: model:ir.model.fields,help:website_event_require_login.field_event_event_website_require_login
msgid "If set, a user must be logged in to be able to register attendees from the website."
msgstr "Si está establecido, el usuario deberá iniciar sesión para registrar asistentes desde el sito web."

#. module: website_event_require_login
#: model:ir.ui.view,arch_db:website_event_require_login.modal_attendees_registration_login_required
msgid "Login"
msgstr "Iniciar sesión"

#. module: website_event_require_login
#: model:ir.ui.view,arch_db:website_event_require_login.modal_attendees_registration_login_required
msgid "Login required"
msgstr "Inicio de sesión requerido"

#. module: website_event_require_login
#: model:ir.model.fields,field_description:website_event_require_login.field_event_event_website_require_login
msgid "Require login for website registrations"
msgstr "Requerir inicio de sesión para registros desde la página web"

#. module: website_event_require_login
#: model:ir.ui.view,arch_db:website_event_require_login.modal_attendees_registration_login_required
msgid "You must be logged in to be able to register to this event."
msgstr "Debe iniciar sesión para poder regitrase en este evento."

57 changes: 57 additions & 0 deletions website_event_require_login/i18n/website_event_require_login.pot
@@ -0,0 +1,57 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_event_require_login
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-03-19 11:59+0000\n"
"PO-Revision-Date: 2019-03-19 11:59+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_require_login
#: model:ir.ui.view,arch_db:website_event_require_login.modal_attendees_registration_login_required
msgid "&amp;times;"
msgstr ""

#. module: website_event_require_login
#: model:ir.ui.view,arch_db:website_event_require_login.modal_attendees_registration_login_required
msgid "Close"
msgstr ""

#. module: website_event_require_login
#: model:ir.model,name:website_event_require_login.model_event_event
msgid "Event"
msgstr ""

#. module: website_event_require_login
#: model:ir.model.fields,help:website_event_require_login.field_event_event_website_require_login
msgid "If set, a user must be logged in to be able to register attendees from the website."
msgstr ""

#. module: website_event_require_login
#: model:ir.ui.view,arch_db:website_event_require_login.modal_attendees_registration_login_required
msgid "Login"
msgstr ""

#. module: website_event_require_login
#: model:ir.ui.view,arch_db:website_event_require_login.modal_attendees_registration_login_required
msgid "Login required"
msgstr ""

#. module: website_event_require_login
#: model:ir.model.fields,field_description:website_event_require_login.field_event_event_website_require_login
msgid "Require login for website registrations"
msgstr ""

#. module: website_event_require_login
#: model:ir.ui.view,arch_db:website_event_require_login.modal_attendees_registration_login_required
msgid "You must be logged in to be able to register to this event."
msgstr ""

1 change: 1 addition & 0 deletions website_event_require_login/models/__init__.py
@@ -0,0 +1 @@
from . import event
15 changes: 15 additions & 0 deletions website_event_require_login/models/event.py
@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
# Copyright 2019 Tecnativa - David Vidal
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models


class EventEvent(models.Model):
_inherit = 'event.event'

website_require_login = fields.Boolean(
string='Require login for website registrations',
help='If set, a user must be logged in to be able to register '
'attendees from the website.',
default=False,
)
3 changes: 3 additions & 0 deletions website_event_require_login/readme/CONFIGURE.rst
@@ -0,0 +1,3 @@
To configure this module, you need to:

#. Go to an event and set the Website Require option on.
3 changes: 3 additions & 0 deletions website_event_require_login/readme/CONTRIBUTORS.rst
@@ -0,0 +1,3 @@
* `Tecnativa <https://www.tecnativa.com>`_:
* David Vidal
* Rafael Blasco
1 change: 1 addition & 0 deletions website_event_require_login/readme/DESCRIPTION.rst
@@ -0,0 +1 @@
Require login for event registration from the website.
3 changes: 3 additions & 0 deletions website_event_require_login/readme/ROADMAP.rst
@@ -0,0 +1,3 @@
* An interesting option could be to be able to hide events to unregistered
users.

5 changes: 5 additions & 0 deletions website_event_require_login/readme/USAGE.rst
@@ -0,0 +1,5 @@
In the website go to an event that requieres login and try to register being
logged out.

If the event is set up to require login, a pop up will be shown requiring the
user to do so.

0 comments on commit 6bf874f

Please sign in to comment.