From ac3c4e6f6736ae4ad3b755c42591ae105d0bad83 Mon Sep 17 00:00:00 2001 From: ijas ahammed Date: Fri, 17 Sep 2021 08:55:56 +0000 Subject: [PATCH] [IMP] website_slides: improve content list view This commit makes the content list view simpler, which now has following fields - name - channel_id - category_id (optional, default hidden) - user_id (with "many2one_avatar_user" widget) - is_published - date_published - completion_time (displays total and added float time widget) Note that the view is now multi-edit, but we only want to update 'user_id' and 'is_published' fields in batch. So all other fields are readonly. We have removed tracking from `date_published`, `website_published` field and added tracking for `is_published` field. This information is sufficient. TaskID-2607467 Part-of: odoo/odoo#76930 --- addons/website_slides/models/slide_slide.py | 4 +++- .../views/slide_slide_views.xml | 20 ++++++++----------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/addons/website_slides/models/slide_slide.py b/addons/website_slides/models/slide_slide.py index 1982b283607..ed11dcf1116 100644 --- a/addons/website_slides/models/slide_slide.py +++ b/addons/website_slides/models/slide_slide.py @@ -160,7 +160,7 @@ class Slide(models.Model): html_content = fields.Html("HTML Content", help="Custom HTML content for slides of type 'Web Page'.", translate=True, sanitize_attributes=False, sanitize_form=False) # website website_id = fields.Many2one(related='channel_id.website_id', readonly=True) - date_published = fields.Datetime('Publish Date', readonly=True, tracking=1) + date_published = fields.Datetime('Publish Date', readonly=True, tracking=False) likes = fields.Integer('Likes', compute='_compute_user_info', store=True, compute_sudo=False) dislikes = fields.Integer('Dislikes', compute='_compute_user_info', store=True, compute_sudo=False) user_vote = fields.Integer('User vote', compute='_compute_user_info', compute_sudo=False) @@ -183,6 +183,8 @@ class Slide(models.Model): nbr_webpage = fields.Integer("Number of Webpages", compute='_compute_slides_statistics', store=True) nbr_quiz = fields.Integer("Number of Quizs", compute="_compute_slides_statistics", store=True) total_slides = fields.Integer(compute='_compute_slides_statistics', store=True) + is_published = fields.Boolean(tracking=1) + website_published = fields.Boolean(tracking=False) _sql_constraints = [ ('exclusion_html_content_and_url', "CHECK(html_content IS NULL OR url IS NULL)", "A slide is either filled with a document url or HTML content. Not both.") diff --git a/addons/website_slides/views/slide_slide_views.xml b/addons/website_slides/views/slide_slide_views.xml index d9ed6f72ffa..ca018fb7a17 100644 --- a/addons/website_slides/views/slide_slide_views.xml +++ b/addons/website_slides/views/slide_slide_views.xml @@ -273,18 +273,14 @@ slide.slide.tree slide.slide - - - - - - - - - - - - + + + + + + + +