Skip to content
Snippets Groups Projects
Commit ebadf16c authored by Thibault Francois's avatar Thibault Francois
Browse files

[FIX] website_event: make allowed_field customizable

Problem
-------
Since
https://github.com/odoo/odoo/commit/d3b18979bfb5496fa4370fdf03a806c469127730

,
when a visitor register for an event, the fields in the POST are checked against a list of allowed fields.

The list is hardcoded inside the method _process_attendees_form.

Solution
--------
Move this list in a specific method that can be easily overidden by
another module

closes odoo/odoo#66757

Signed-off-by: default avatarThibault Delavallee (tde) <tde@openerp.com>
parent 72e96af8
Branches
Tags
No related merge requests found
......@@ -320,7 +320,7 @@ class WebsiteEventController(http.Controller):
:param form_details: posted data from frontend registration form, like
{'1-name': 'r', '1-email': 'r@r.com', '1-phone': '', '1-event_ticket_id': '1'}
"""
allowed_fields = {'name', 'phone', 'email', 'mobile', 'event_id', 'partner_id', 'event_ticket_id'}
allowed_fields = request.env['event.registration']._get_website_registration_allowed_fields()
registration_fields = {key: v for key, v in request.env['event.registration']._fields.items() if key in allowed_fields}
registrations = {}
global_values = {}
......
......@@ -9,3 +9,6 @@ class EventRegistration(models.Model):
_inherit = ['event.registration']
visitor_id = fields.Many2one('website.visitor', string='Visitor', ondelete='set null')
def _get_website_registration_allowed_fields(self):
return {'name', 'phone', 'email', 'mobile', 'event_id', 'partner_id', 'event_ticket_id'}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment