diff --git a/addons/website_slides/i18n/website_slides.pot b/addons/website_slides/i18n/website_slides.pot index 65612bd835a4e439cd431a0d40c54d8d77281b8f..375d3b14002547fee82141e12d6291d9efdebb4a 100644 --- a/addons/website_slides/i18n/website_slides.pot +++ b/addons/website_slides/i18n/website_slides.pot @@ -5150,6 +5150,14 @@ msgstr "" msgid "Yes" msgstr "" +#. module: website_slides +#: code:addons/website_slides/wizard/slide_channel_invite.py:0 +#, python-format +msgid "" +"You are not allowed to add members to this course. Please contact the course" +" responsible or an administrator." +msgstr "" + #. module: website_slides #. openerp-web #: code:addons/website_slides/static/src/js/tours/slides_tour.js:0 diff --git a/addons/website_slides/wizard/slide_channel_invite.py b/addons/website_slides/wizard/slide_channel_invite.py index 737651e6a35d8368eafb9c4147ecca7a64f637de..83ca90d9a29315ef506049451de9bb42d0f5b0d3 100644 --- a/addons/website_slides/wizard/slide_channel_invite.py +++ b/addons/website_slides/wizard/slide_channel_invite.py @@ -5,7 +5,7 @@ import logging import re from odoo import api, fields, models, _ -from odoo.exceptions import UserError +from odoo.exceptions import UserError, AccessError from odoo.tools import formataddr _logger = logging.getLogger(__name__) @@ -78,6 +78,12 @@ class SlideChannelInvite(models.TransientModel): if not self.env.user.email: raise UserError(_("Unable to post message, please configure the sender's email address.")) + try: + self.channel_id.check_access_rights('write') + self.channel_id.check_access_rule('write') + except AccessError: + raise AccessError(_('You are not allowed to add members to this course. Please contact the course responsible or an administrator.')) + mail_values = [] for partner_id in self.partner_ids: slide_channel_partner = self.channel_id._action_add_members(partner_id)