From 3ea1ac7e0de0ee2cbf84776d8c88ee2c103b7fe5 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Mon, 11 Jul 2016 14:00:33 +0200 Subject: [PATCH] [FIX] website_slides: changing channel_id on slide.slide Steps: -Go into Slides (into Website Admin main menu) -Find the Slide "Odoo Explained" -Change the channel to "Employee Channel" -Disconnect or open a private session -Go to the menu "Presentations" on website -Click on "Public channel" Bug: Error 403 Fix: When changing the channel_id of a slide, the custom_slide_id of all the channels using this slide as "Slide to Promote" has to change in False to avoid access rights errors. opw:682063 --- addons/website_slides/models/slides.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/website_slides/models/slides.py b/addons/website_slides/models/slides.py index 57a3e4f15ae..71a2adde0f4 100644 --- a/addons/website_slides/models/slides.py +++ b/addons/website_slides/models/slides.py @@ -373,6 +373,9 @@ class Slide(models.Model): doc_data = self._parse_document_url(values['url']).get('values', dict()) for key, value in doc_data.iteritems(): values.setdefault(key, value) + if values.get('channel_id'): + custom_channels = self.env['slide.channel'].search([('custom_slide_id', '=', self.id), ('id', '!=', values.get('channel_id'))]) + custom_channels.write({'custom_slide_id': False}) res = super(Slide, self).write(values) if values.get('website_published'): self.date_published = datetime.datetime.now()