Skip to content
Snippets Groups Projects
Commit db37a4e2 authored by Hansun (hale)'s avatar Hansun (hale)
Browse files

[FIX] event{._sms}: access right for admins of event app


1. Install [Events]

2. On [Settings], create an admin for Events (uncheck all other rights)

3. Click on Events, enter an event

3. Click on [Communication] tab, and try adding a line

Issue: accessing ir.model is blocked

Solution: Find another way

Impacted versions: 15 - master

opw-3163138, 3103199, 3193659

closes odoo/odoo#115101

Related: odoo/enterprise#38097
Signed-off-by: default avatarNicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: default avatarLee, Hansun (hale) <hale@odoo.com>
parent 516343da
Branches
Tags
No related merge requests found
......@@ -80,6 +80,12 @@ class EventMailScheduler(models.Model):
def _selection_template_model(self):
return [('mail.template', 'Mail')]
@api.onchange('notification_type')
def set_template_ref_model(self):
mail_model = self.env['mail.template']
if self.notification_type == 'mail':
self.template_ref = "{},{}".format('mail.template', mail_model.search([('model', '=', 'event.registration')], limit=1).id)
event_id = fields.Many2one('event.event', string='Event', required=True, ondelete='cascade')
sequence = fields.Integer('Display order')
notification_type = fields.Selection([('mail', 'Mail')], string='Send', default='mail', required=True)
......
This diff is collapsed.
......@@ -60,6 +60,13 @@ class EventMailScheduler(models.Model):
return super(EventMailScheduler, self).execute()
@api.onchange('notification_type')
def set_template_ref_model(self):
super().set_template_ref_model()
mail_model = self.env['sms.template']
if self.notification_type == 'sms':
self.template_ref = "{},{}".format('sms.template', mail_model.search([('model', '=', 'event.registration')], limit=1).id)
class EventMailRegistration(models.Model):
_inherit = 'event.mail.registration'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment