From be5f07c6122d5e8613f2755f2bc7bb6e888c471c Mon Sep 17 00:00:00 2001 From: Julien Castiaux Date: Tue, 7 May 2019 12:39:55 +0000 Subject: [PATCH] [FIX] calendar: Cannot create 'free' event with reminder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Install CRM (we need the "Hide Private Message" record rule defined by that module), create a meeting as of today, set a reminder of one day, invite another user (Demo) as attendee, save. Edit, go to the options, change the "Show time as" to "free", save => access error due to the said record rule. The reminder is handled by the `get_next_potential_limit_alarm` method of the `calendar.alarm_manager` model. It uses a raw SQL query to perform its search. It returns a dictionary of the different events with data attached. Due to the "Hide Private Message" record rule, some records are not accessible. Original (reverted) 9c4b52000 fix was replacing the `browse` by a `search` in order to filter out non-accessible records. That fix was later fine tuned by (not-merged) 7dd93809c to exclude calendar's virtual ids. The real fix is to filter out records in the original result dict. opw-1974599 closes odoo/odoo#33209 Signed-off-by: Jérémy Kersten (jke) Co-authored-by: Raphël Collet --- addons/calendar/models/calendar.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/calendar/models/calendar.py b/addons/calendar/models/calendar.py index 677afec01c0..5cc3e8faa2d 100644 --- a/addons/calendar/models/calendar.py +++ b/addons/calendar/models/calendar.py @@ -323,6 +323,12 @@ class AlarmManager(models.AbstractModel): 'rrule': rule } + # determine accessible events + events = self.env['calendar.event'].browse(result) + result = { + key: result[key] + for key in set(events._filter_access_rules('read').ids) + } return result def do_check_alarm_for_one_date(self, one_date, event, event_maxdelta, in_the_next_X_seconds, alarm_type, after=False, missing=False):