[FIX] website_slides: return the record for next_category
This error occurs when user tries to click on the checkbox to 'Mark as done'. Steps to produce: - Install the `website_slides` module. - Go to Website > Courses > Open a course containing one or more sections (e.g., 'Taking care of Trees'). - Click on the `Add Content` button located at the bottom in blue. - Select the video option and upload two videos, one after the other. - Now, click the 'Mark as done' checkbox for the first video. - When attempting to click the 'Mark as done' checkbox for the second video, the error will occur. Error: AttributeError: 'int' object has no attribute 'id' To solve this issue we have returned the record for `next_category`from that it will get the record `id`. Previously, this code returned an integer value, see here: https://github.com/odoo/odoo/blob/f34d87ecb7772417f1dd8f3d8836c89ddb903de8/addons/website_slides/models/slide_slide.py#L1321 here we are using that return value from the above line https://github.com/odoo/odoo/blob/69fca30bb4fb66e6d979ce5ddc1bff4db963ca71/addons/website_slides/controllers/main.py#L1062 Previously it gets the integer and try to get id of that integer value. sentry-4414398591 closes odoo/odoo#135805 X-original-commit: 9cc11ef9a0f2025a717602fb2087b96eda5e8218 Signed-off-by: Achraf Ben Azzouz (abz) <abz@odoo.com>
This commit is contained in:
@@ -1340,7 +1340,7 @@ class Slide(models.Model):
|
||||
# If current slide is uncategorized and all the channel uncategorized slides are completed, return the first category
|
||||
if not self.category_id and all(self.channel_id.slide_ids.filtered(
|
||||
lambda s: not s.is_category and not s.category_id).mapped('user_has_completed')):
|
||||
return channel_category_ids[0]
|
||||
return self.env['slide.slide'].browse(channel_category_ids[0])
|
||||
# If current category is completed and current category is not the last one, get next category
|
||||
elif self.user_has_completed_category and self.category_id.id in channel_category_ids and self.category_id.id != channel_category_ids[-1]:
|
||||
index_current_category = channel_category_ids.index(self.category_id.id)
|
||||
|
||||
Reference in New Issue
Block a user