From 362271f35ad1a2c0bb15b1069deaa864c5100a3b Mon Sep 17 00:00:00 2001 From: David Beguin Date: Mon, 25 Feb 2019 15:13:38 +0000 Subject: [PATCH] [FIX] website_slides: fix some small model-related issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * improve is_preview field string and help. 'Always visible' was not really clear and self speaking. A help string is added to describe what this field implies; * fix slide.channel invite button for 'invite' enroll mode. While renaming the "visibility" field to "enroll", a check was missed for the slide.channel invite feature. This commit fixes it by properly checking for enroll instead of visibility; Commit linked to task ID 1942852 and PR #31394. Co-Authored-By: David Beguin Co-Authored-By: Aurélien Warnon --- addons/website_slides/models/slide_channel.py | 2 +- addons/website_slides/models/slide_slide.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/website_slides/models/slide_channel.py b/addons/website_slides/models/slide_channel.py index 3dfba4e7576..30aee951c11 100644 --- a/addons/website_slides/models/slide_channel.py +++ b/addons/website_slides/models/slide_channel.py @@ -338,7 +338,7 @@ class Channel(models.Model): def action_channel_invite(self): self.ensure_one() - if self.visibility != 'invite': + if self.enroll != 'invite': raise UserError(_("You cannot send invitations for channels that are not set as 'invite'.")) template = self.env.ref('website_slides.mail_template_slide_channel_invite', raise_if_not_found=False) diff --git a/addons/website_slides/models/slide_slide.py b/addons/website_slides/models/slide_slide.py index 0ab75feec59..9ca2eff8adb 100644 --- a/addons/website_slides/models/slide_slide.py +++ b/addons/website_slides/models/slide_slide.py @@ -105,7 +105,7 @@ class Slide(models.Model): category_id = fields.Many2one('slide.category', string="Category", domain="[('channel_id', '=', channel_id)]") tag_ids = fields.Many2many('slide.tag', 'rel_slide_tag', 'slide_id', 'tag_id', string='Tags') access_token = fields.Char("Security Token", copy=False, default=_default_access_token) - is_preview = fields.Boolean('Always visible', default=False) + is_preview = fields.Boolean('Is Preview', default=False, help="The course is accessible by anyone : the users don't need to join the channel to access the content of the course.") completion_time = fields.Float('# Hours', default=1, digits=(10, 4)) # subscribers partner_ids = fields.Many2many('res.partner', 'slide_slide_partner', 'slide_id', 'partner_id',