diff options
| author | Thibault Delavallée <tde@odoo.com> | 2020-04-01 12:36:17 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2020-04-03 11:07:56 +0000 |
| commit | b29b4bcbfc61aab1035de1f8b0cb9c796cd4bc58 (patch) | |
| tree | 29b7897051ec4e24d81610e616292730bbca9389 /addons | |
| parent | d2840a0519725c8d55cafe9e2b91ebbfe515c804 (diff) | |
[FIX] event: ensure event_registrations_open can always be computed
Using a compute_sudo ensure this field is correctly computed (aka without
crash) if someone is allowed to read the event but not all its sub models.
For example event_registrations_open reads the active flag of a product
linked to a ticker which may not be readable by public users. This field
is used in frontend templates and therefore usable by external people.
Also remove unnecessary registrable rendering parameter in website_event
as it has been replaced by computed fields.
Task ID 2228189
Community PR odoo/odoo#48652
X-original-commit: b2b334a65f3a1379f25717ec39f0a52f3305b19c
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/event/models/event_event.py | 2 | ||||
| -rw-r--r-- | addons/website_event/controllers/main.py | 1 |
2 files changed, 1 insertions, 2 deletions
diff --git a/addons/event/models/event_event.py b/addons/event/models/event_event.py index b4f740a89bf..d8e60bb373c 100644 --- a/addons/event/models/event_event.py +++ b/addons/event/models/event_event.py @@ -168,7 +168,7 @@ class EventEvent(models.Model): 'event.event.ticket', 'event_id', string='Event Ticket', copy=True, compute='_compute_from_event_type', readonly=False, store=True) event_registrations_open = fields.Boolean( - 'Registration open', compute='_compute_event_registrations_open', + 'Registration open', compute='_compute_event_registrations_open', compute_sudo=True, help='Registrations are open if event is not ended, seats are available on event and if tickets are sellable if ticketing is used.') start_sale_date = fields.Date( 'Start sale date', compute='_compute_start_sale_date', diff --git a/addons/website_event/controllers/main.py b/addons/website_event/controllers/main.py index 11e17a4f7a4..ea484cab7a8 100644 --- a/addons/website_event/controllers/main.py +++ b/addons/website_event/controllers/main.py @@ -211,7 +211,6 @@ class WebsiteEventController(http.Controller): 'sold_out': all(not ticket.sale_available and not ticket.is_expired for ticket in event.event_ticket_ids), 'main_object': event, 'range': range, - 'registrable': event.sudo().event_registrations_open, 'google_url': urls.get('google_url'), 'iCal_url': urls.get('iCal_url'), } |
