[IMP] website_event(_track)_online: improve registration flow
RATIONALE Events are sometimes held online, gathering a community. In this merge we improve Event application to better support full-online events with improved tracks, wishlists, chat rooms, . PURPOSE Improve the overall registration flow. In addition to already improved features (email, standard pages), some improvements are done here specifically for Online feature. SPECIFICATIONS: REGISTER MENU Add a register button to the right that can be removed through an option on the event itself. Currently register menu is lost within other event menus. In this commit we add a CTA to the right lf event naviguation in order to show it to customers. If current user has registered this button is not displayed. This is done in addition to already existing register menu. This one can be tweaked through frontend menu edition. CTA has another purpose, bringing people to register through a visible CTA. SPECIFICATIONS: REGISTRATION CONFIMATION At the end of registration process, add a link to the talks. It allows to send people directly to the talk page in order to complete their wishlist. SPECIFICATIONS: IS PARTICIPATING Make "is participating" field functionally working for public users. It is now computed based on visitor. If a visitor is available check its registrations in order to determine if current user has registered to the event. Remove support of 'email' based computation of "is participating" as this is quite unsafe: partner and visitor should give results interesting enough.h. LINKS Community PR #53540 Enterprise PR odoo/enterprise#11384 Task ID-2252655 (Main Online Event task) Task ID-2283796 (Event B2Basics / Registration Flow) Co-Authored-By: Aurélien Warnon <awa@odoo.com> Co-Authored-By: David Beguin <dbe@odoo.com> Co-Authored-By: Thibault Delavallée <tde@odoo.com>
This commit is contained in:
co-authored by
Aurélien Warnon
David Beguin
parent
96da588891
commit
ae8ac2ebb3
@@ -18,9 +18,11 @@
|
||||
'views/event_event_views.xml',
|
||||
'views/event_registration_views.xml',
|
||||
'views/website_visitor_views.xml',
|
||||
'views/event_templates_event.xml',
|
||||
],
|
||||
'demo': [
|
||||
'data/website_visitor_demo.xml',
|
||||
'data/event_demo.xml',
|
||||
'data/event_registration_demo.xml',
|
||||
],
|
||||
'application': False,
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="event.event_1" model="event.event">
|
||||
<field name="menu_register_cta" eval="True"/>
|
||||
</record>
|
||||
<record id="event.event_7" model="event.event">
|
||||
<field name="menu_register_cta" eval="True"/>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -1,14 +1,65 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import models, _
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.addons.http_routing.models.ir_http import slug
|
||||
from odoo.osv import expression
|
||||
|
||||
|
||||
class Event(models.Model):
|
||||
_name = 'event.event'
|
||||
_inherit = 'event.event'
|
||||
|
||||
# frontend options
|
||||
menu_register_cta = fields.Boolean(
|
||||
'Add Register Button', compute='_compute_menu_register_cta',
|
||||
readonly=False, store=True)
|
||||
|
||||
@api.depends('website_menu')
|
||||
def _compute_menu_register_cta(self):
|
||||
for event in self:
|
||||
event.menu_register_cta = event.website_menu
|
||||
|
||||
def _compute_is_participating(self):
|
||||
""" Override is_participating to improve heuristic that is now
|
||||
|
||||
* public, no visitor: not participating as we have no information;
|
||||
* public and visitor: check visitor is linked to a registration. As
|
||||
visitors are merged on the top parent, current visitor check is
|
||||
sufficient even for successive visits;
|
||||
* logged, no visitor: check partner is linked to a registration. Do
|
||||
not check the email as it is not really secure;
|
||||
* logged as visitor: check partner or visitor are linked to a
|
||||
registration;
|
||||
"""
|
||||
current_visitor = self.env['website.visitor']._get_visitor_from_request(force_create=False)
|
||||
if self.env.user._is_public() and not current_visitor:
|
||||
events = self.env['event.event']
|
||||
elif self.env.user._is_public():
|
||||
events = self.env['event.registration'].sudo().search([
|
||||
('event_id', 'in', self.ids),
|
||||
('visitor_id', '=', current_visitor.id),
|
||||
]).event_id
|
||||
else:
|
||||
if current_visitor:
|
||||
domain = [
|
||||
'|',
|
||||
('partner_id', '=', self.env.user.partner_id.id),
|
||||
('visitor_id', '=', current_visitor.id)
|
||||
]
|
||||
else:
|
||||
domain = [('partner_id', '=', self.env.user.partner_id.id)]
|
||||
events = self.env['event.registration'].sudo().search(
|
||||
expression.AND([
|
||||
domain,
|
||||
[('event_id', 'in', self.ids)]
|
||||
])
|
||||
).event_id
|
||||
|
||||
|
||||
for event in self:
|
||||
event.is_participating = event in events
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# WEBSITE MENU MANAGEMENT
|
||||
# ------------------------------------------------------------
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
<div name="event_menu_configuration" groups="base.group_no_one">
|
||||
<label for="website_menu" string="Website Submenu"/>
|
||||
<field name="website_menu"/>
|
||||
<label for="menu_register_cta" string="Register Button"/>
|
||||
<field name="menu_register_cta"/>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<!-- Add Register additional CTA button, in addition to menus -->
|
||||
<template id="event_layout_main" inherit_id="website_event.layout">
|
||||
<xpath expr="//div[@id='o_wevent_event_submenu']/ul" position="after">
|
||||
<a t-if="event.menu_register_cta and not event.is_participating"
|
||||
t-att-href="'/event/%s/register' % (slug(event))"
|
||||
class="btn btn-primary ml-auto">
|
||||
Register
|
||||
</a>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
</odoo>
|
||||
@@ -19,8 +19,9 @@
|
||||
'security/ir.model.access.csv',
|
||||
'views/assets.xml',
|
||||
'views/event_event_views.xml',
|
||||
'views/event_track_templates_reminder.xml',
|
||||
'views/event_templates_registration.xml',
|
||||
'views/event_track_templates.xml',
|
||||
'views/event_track_templates_reminder.xml',
|
||||
'views/event_track_views.xml',
|
||||
'views/event_track_visitor_views.xml',
|
||||
'views/website_visitor_views.xml',
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<!-- Add a shortcut to wishlist / talks after registration -->
|
||||
<template id="registration_complete" inherit_id="website_event.registration_complete">
|
||||
<xpath expr="//div[hasclass('row')][last()]" position="after">
|
||||
<div t-if="event.website_track" class="row mt-5">
|
||||
<div class="col-12">
|
||||
<h3>Book your seats to the best talks</h3>
|
||||
<p>Get prepared and
|
||||
<a t-att-href="'/event/%s/track' % (slug(event))">register to your favorites talks now.</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user