summaryrefslogtreecommitdiff
path: root/addons/calendar/models
diff options
context:
space:
mode:
authorMartin Trigaux <mat@odoo.com>2020-05-25 07:04:52 +0000
committerMartin Trigaux <mat@odoo.com>2020-08-17 09:09:02 +0000
commit6156f98288b16f6c84d36bacf16d5a66a661abb3 (patch)
tree7a760d990d660640fed108a5d1fb5c8ce62a52e5 /addons/calendar/models
parentd5c16492397047ceb97a0879aa61f068a0eeeca8 (diff)
[FIX] *: adapt action content retrieval
Use _for_xml_id to replace all the self.env.ref().read()[0] This has the advantage of having a single point of control and to add the fields filtering and model verification. Add sudo for other operations on ir.actions.*
Diffstat (limited to 'addons/calendar/models')
-rw-r--r--addons/calendar/models/calendar_attendee.py2
-rw-r--r--addons/calendar/models/mail_activity.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/addons/calendar/models/calendar_attendee.py b/addons/calendar/models/calendar_attendee.py
index a7d5f1ccd0d..0aeb5d51a63 100644
--- a/addons/calendar/models/calendar_attendee.py
+++ b/addons/calendar/models/calendar_attendee.py
@@ -107,7 +107,7 @@ class Attendee(models.Model):
rendering_context.update({
'colors': colors,
'ignore_recurrence': ignore_recurrence,
- 'action_id': self.env['ir.actions.act_window'].search([('view_id', '=', calendar_view.id)], limit=1).id,
+ 'action_id': self.env['ir.actions.act_window'].sudo().search([('view_id', '=', calendar_view.id)], limit=1).id,
'dbname': self._cr.dbname,
'base_url': self.env['ir.config_parameter'].sudo().get_param('web.base.url', default='http://localhost:8069'),
})
diff --git a/addons/calendar/models/mail_activity.py b/addons/calendar/models/mail_activity.py
index 71d7bf0fadb..58ca5ff75d4 100644
--- a/addons/calendar/models/mail_activity.py
+++ b/addons/calendar/models/mail_activity.py
@@ -17,7 +17,7 @@ class MailActivity(models.Model):
def action_create_calendar_event(self):
self.ensure_one()
- action = self.env.ref('calendar.action_calendar_event').read()[0]
+ action = self.env["ir.actions.actions"]._for_xml_id("calendar.action_calendar_event")
action['context'] = {
'default_activity_type_id': self.activity_type_id.id,
'default_res_id': self.env.context.get('default_res_id'),