[FIX] calendar: Cannot create 'free' event with reminder

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) <jke@openerp.com>


Co-authored-by: Raphël Collet <rco@odoo.com>
This commit is contained in:
Julien Castiaux
2019-05-15 11:41:21 +00:00
co-authored by Raphël Collet
parent 8ffedf4545
commit be5f07c612
+6
View File
@@ -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):