From cc1d78a80b518bd5eaec7eb70d7bc14ec4c31275 Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Mon, 13 May 2019 17:29:24 +0000 Subject: [PATCH] [IMP] *: correctly read/write website_published The `website_published` field from the website's mixins is basically a readonly from `is_published` field. On read, this field will simply read `is_published` and check if the record's website_id is accessible (only for the multi mixin). On write, it will always write on `is_published`. This commit improves a few things: - A lot of code was writting on website_published which was just then writting on is_published. Writting directly on is_published makes more sense. - Some backend fields would still reference `website_published` instead of `is_published` which would just go through the related for no reason. Plus, using `is_published` will make the field tooltip more accurate as we are not in a website context ('Visible on current website' to 'Is Published') - Filter and search on tree view were still using the `website_published` related field, which is just a readonly when we are not in a frontend context. - Some create and write function would have security check on `website_published` value but that was wrong as the user could bypass that by simply writting on `is_published`. For the write method, check `is_published` is more accurate as it will cover both case since `website_published` will then call the write method on `is_published` --- .../test_website/data/test_website_data.xml | 2 +- addons/website/data/website_data.xml | 6 +- addons/website/data/website_demo.xml | 4 +- addons/website/models/mixins.py | 1 - addons/website/tests/test_page.py | 4 +- addons/website/views/website_views.xml | 5 +- addons/website_blog/controllers/main.py | 2 +- .../website_blog/data/website_blog_demo.xml | 4 +- addons/website_blog/models/website_blog.py | 7 ++- .../data/res_partner_grade_demo.xml | 8 +-- .../data/res_partner_demo.xml | 8 +-- .../views/res_partner_views.xml | 4 +- addons/website_event/data/event_demo.xml | 14 ++--- .../website_event_track/data/event_demo.xml | 60 +++++++++---------- .../views/website_form_templates.xml | 2 +- .../data/hr_job_demo.xml | 6 +- .../website_hr_recruitment_templates.xml | 2 +- .../data/membership_demo.xml | 4 +- .../data/website_partner_data.xml | 4 +- .../data/website_partner_demo.xml | 26 ++++---- addons/website_rating/models/rating.py | 2 - addons/website_sale/data/demo.xml | 46 +++++++------- addons/website_sale/tests/test_customize.py | 4 +- addons/website_sale/views/product_views.xml | 2 +- .../data/website_sale_delivery_data.xml | 2 +- .../data/website_sale_delivery_demo.xml | 4 +- .../views/website_sale_delivery_views.xml | 4 +- .../data/product_demo.xml | 2 +- .../data/demo.xml | 2 +- .../data/website_sale_slides_demo.xml | 8 +-- .../data/website_sale_stock_demo.xml | 2 +- addons/website_slides/controllers/main.py | 8 +-- .../website_slides/data/gamification_data.xml | 10 ++-- .../data/slide_channel_demo.xml | 12 ++-- .../data/slide_channel_tag_demo.xml | 4 +- addons/website_slides/data/slide_data.xml | 4 +- .../website_slides/data/slide_slide_demo.xml | 32 +++++----- addons/website_slides/models/slide_channel.py | 4 +- addons/website_slides/models/slide_slide.py | 6 +- .../static/src/js/slides_upload.js | 2 +- addons/website_slides/tests/common.py | 4 +- addons/website_slides/tests/test_karma.py | 6 +- addons/website_slides/tests/test_security.py | 8 +-- .../website_slides/tests/test_statistics.py | 4 +- .../views/slide_channel_tag_views.xml | 9 ++- .../views/slide_slide_views.xml | 4 +- .../data/gamification_data.xml | 2 +- .../data/slide_slide_demo.xml | 4 +- .../test_course_certification_failure.py | 4 +- doc/howtos/website/course-product | 6 +- 50 files changed, 193 insertions(+), 191 deletions(-) diff --git a/addons/test_website/data/test_website_data.xml b/addons/test_website/data/test_website_data.xml index 05a248190d4..37a0949f0bb 100644 --- a/addons/test_website/data/test_website_data.xml +++ b/addons/test_website/data/test_website_data.xml @@ -69,7 +69,7 @@ - True + True /test_page_view diff --git a/addons/website/data/website_data.xml b/addons/website/data/website_data.xml index c1af4f0c985..3f62209b807 100644 --- a/addons/website/data/website_data.xml +++ b/addons/website/data/website_data.xml @@ -117,17 +117,17 @@ - True + True / /contactus - True + True - True + True /aboutus diff --git a/addons/website/data/website_demo.xml b/addons/website/data/website_demo.xml index daa3329fa32..8efebf26764 100644 --- a/addons/website/data/website_demo.xml +++ b/addons/website/data/website_demo.xml @@ -303,7 +303,7 @@ /website/demo/bootstrap - False + False @@ -311,7 +311,7 @@ /website/demo/snippets - False + False diff --git a/addons/website/models/mixins.py b/addons/website/models/mixins.py index 11f9823c1ca..e9c08d2c31d 100644 --- a/addons/website/models/mixins.py +++ b/addons/website/models/mixins.py @@ -146,7 +146,6 @@ class WebsitePublishedMixin(models.AbstractModel): @api.model_create_multi def create(self, vals_list): records = super(WebsitePublishedMixin, self).create(vals_list) - is_publish_modified = any('website_published' in values for values in vals_list) if is_publish_modified and not all(record.can_publish for record in records): raise AccessError(self._get_can_publish_error_message()) diff --git a/addons/website/tests/test_page.py b/addons/website/tests/test_page.py index 88f09bfc2ed..57088999132 100644 --- a/addons/website/tests/test_page.py +++ b/addons/website/tests/test_page.py @@ -197,11 +197,11 @@ class Crawler(HttpCase): generic_page = Page.create({ 'view_id': base_view.id, 'url': '/page_1', - 'website_published': True, + 'is_published': True, }) specific_page = generic_page.copy({'website_id': self.env['website'].get_current_website().id}) - specific_page.write({'website_published': False, 'arch': generic_page.arch.replace('I am a generic page', 'I am a specific page')}) + specific_page.write({'is_published': False, 'arch': generic_page.arch.replace('I am a generic page', 'I am a specific page')}) r = self.url_open(specific_page.url) self.assertEqual(r.status_code, 404, "Restricted users should see a 404 and not the generic one as we unpublished the specific one") diff --git a/addons/website/views/website_views.xml b/addons/website/views/website_views.xml index fdab0212066..fa98035100a 100644 --- a/addons/website/views/website_views.xml +++ b/addons/website/views/website_views.xml @@ -145,12 +145,11 @@ - - + @@ -170,7 +169,7 @@ - + diff --git a/addons/website_blog/controllers/main.py b/addons/website_blog/controllers/main.py index 1d09540e8cf..0874169871d 100644 --- a/addons/website_blog/controllers/main.py +++ b/addons/website_blog/controllers/main.py @@ -286,7 +286,7 @@ class WebsiteBlog(http.Controller): new_blog_post = request.env['blog.post'].create({ 'blog_id': blog_id, - 'website_published': False, + 'is_published': False, }) return werkzeug.utils.redirect("/blog/%s/post/%s?enable_editor=1" % (slug(new_blog_post.blog_id), slug(new_blog_post))) diff --git a/addons/website_blog/data/website_blog_demo.xml b/addons/website_blog/data/website_blog_demo.xml index bb9106206d0..f80c2bd782d 100644 --- a/addons/website_blog/data/website_blog_demo.xml +++ b/addons/website_blog/data/website_blog_demo.xml @@ -15,7 +15,7 @@ Ideas behind the Odoo communication tools. - + Odoo, email Ideas behind the Odoo communication tools. @@ -130,7 +130,7 @@ Integrating your CMS and E-Commerce Building your company's website and selling your products online easy. - + {"background-image": "url(/web/image/website_blog.blog_post_cover_02)", "resize_class": "cover container-fluid cover_full", "background-color": "oe_black", "opacity": "0.0"} diff --git a/addons/website_blog/models/website_blog.py b/addons/website_blog/models/website_blog.py index 6bf40b32f63..6ec13d08370 100644 --- a/addons/website_blog/models/website_blog.py +++ b/addons/website_blog/models/website_blog.py @@ -194,7 +194,7 @@ class BlogPost(models.Model): blog_post._write(dict(post_date=blog_post.create_date)) # dont trigger inverse function def _check_for_publication(self, vals): - if vals.get('website_published'): + if vals.get('is_published'): for post in self: post.blog_id.message_post_with_view( 'website_blog.blog_post_template_new_post', @@ -214,9 +214,10 @@ class BlogPost(models.Model): result = True for post in self: copy_vals = dict(vals) - if ('website_published' in vals and 'published_date' not in vals and + published_in_vals = set(vals.keys()) & {'is_published', 'website_published'} + if (published_in_vals and 'published_date' not in vals and (not post.published_date or post.published_date <= fields.Datetime.now())): - copy_vals['published_date'] = vals['website_published'] and fields.Datetime.now() or False + copy_vals['published_date'] = vals[list(published_in_vals)[0]] and fields.Datetime.now() or False result &= super(BlogPost, self).write(copy_vals) self._check_for_publication(vals) return result diff --git a/addons/website_crm_partner_assign/data/res_partner_grade_demo.xml b/addons/website_crm_partner_assign/data/res_partner_grade_demo.xml index bce96651c14..c12607f0cbf 100644 --- a/addons/website_crm_partner_assign/data/res_partner_grade_demo.xml +++ b/addons/website_crm_partner_assign/data/res_partner_grade_demo.xml @@ -2,16 +2,16 @@ - + - + - + - + diff --git a/addons/website_customer/data/res_partner_demo.xml b/addons/website_customer/data/res_partner_demo.xml index 9bea8129a98..3ab130b9091 100644 --- a/addons/website_customer/data/res_partner_demo.xml +++ b/addons/website_customer/data/res_partner_demo.xml @@ -3,7 +3,7 @@ - + Deco Addict designs, develops, integrates and supports HR and Supply Chain processes in order to make our customers more productive, responsive and profitable.

@@ -33,7 +33,7 @@ - + A non-profit international educational and scientific organisation, hosting three departments (aeronautics and aerospace, environmental and applied fluid dynamics, and turbomachinery and propulsion).

@@ -61,7 +61,7 @@ - + Deco Addict designs, develops, integrates and supports HR and Supply Chain processes in order to make our customers more productive, responsive and profitable.

@@ -91,7 +91,7 @@ - + A non-profit international educational and scientific organisation, hosting three departments (aeronautics and aerospace, environmental and applied fluid dynamics, and turbomachinery and propulsion).

diff --git a/addons/website_customer/views/res_partner_views.xml b/addons/website_customer/views/res_partner_views.xml index 5c2cf4bec82..e763f00ef8c 100644 --- a/addons/website_customer/views/res_partner_views.xml +++ b/addons/website_customer/views/res_partner_views.xml @@ -22,7 +22,7 @@ - + @@ -37,7 +37,7 @@ - + diff --git a/addons/website_event/data/event_demo.xml b/addons/website_event/data/event_demo.xml index 85b3a6d33ea..b1c120dc471 100644 --- a/addons/website_event/data/event_demo.xml +++ b/addons/website_event/data/event_demo.xml @@ -2,11 +2,11 @@ - True + True - True + True odoo @@ -168,21 +168,21 @@ ]]> - True + True - True + True - True + True odoo - True + True - True + True diff --git a/addons/website_event_track/data/event_demo.xml b/addons/website_event_track/data/event_demo.xml index ce93d170a5a..020c8475959 100644 --- a/addons/website_event_track/data/event_demo.xml +++ b/addons/website_event_track/data/event_demo.xml @@ -88,7 +88,7 @@ How to design a new piece of furniture - + @@ -101,7 +101,7 @@ How to integrate hardware materials in your pieces of furniture - + @@ -113,7 +113,7 @@ Portfolio presentation - + @@ -124,7 +124,7 @@ How to develop automated processes - + @@ -135,7 +135,7 @@ The new way to promote your creations - + @@ -146,7 +146,7 @@ Detailed roadmap of our new products - + @@ -157,7 +157,7 @@ A technical explanation of how to use computer design apps - + @@ -168,7 +168,7 @@ How to optimize your sales, from leads to sales orders - + @@ -181,7 +181,7 @@ How to improve your quality processes - + @@ -194,7 +194,7 @@ Raising qualitive insights from your customers - + @@ -205,7 +205,7 @@ Discover our new design team - + @@ -216,7 +216,7 @@ Latest trends - + @@ -227,7 +227,7 @@ Advanced reporting - + @@ -238,7 +238,7 @@ Partnership programs - + @@ -249,7 +249,7 @@ How to communicate with your community - + @@ -260,7 +260,7 @@ How to follow us on the social media - + @@ -271,7 +271,7 @@ The new marketing strategy - + @@ -282,7 +282,7 @@ How to build your marketing strategy within a competitive environment - + @@ -294,7 +294,7 @@ Advanced lead management : tips and tricks from the fields - + @@ -306,7 +306,7 @@ New Certification Program - + @@ -317,7 +317,7 @@ House of World Cultures - + @@ -328,7 +328,7 @@ Minimal but efficient design - + @@ -339,7 +339,7 @@ Key Success factors selling our furniture - + @@ -350,7 +350,7 @@ Design contest (entire day) - + @@ -361,7 +361,7 @@ Design contest (entire afternoon) - + @@ -372,7 +372,7 @@ My Company global presentation - + @@ -383,7 +383,7 @@ Status & Strategy - + @@ -393,7 +393,7 @@ The new marketing strategy - + @@ -404,7 +404,7 @@ Morning break - + @@ -413,7 +413,7 @@ Lunch - + diff --git a/addons/website_form/views/website_form_templates.xml b/addons/website_form/views/website_form_templates.xml index 95f730e8565..27038682ab6 100644 --- a/addons/website_form/views/website_form_templates.xml +++ b/addons/website_form/views/website_form_templates.xml @@ -74,7 +74,7 @@ Thanks (Contact us) qweb /contactus-thank-you - True + True website_form.contactus_thanks diff --git a/addons/website_hr_recruitment/data/hr_job_demo.xml b/addons/website_hr_recruitment/data/hr_job_demo.xml index 1afc5496c4d..5569eaa6f00 100644 --- a/addons/website_hr_recruitment/data/hr_job_demo.xml +++ b/addons/website_hr_recruitment/data/hr_job_demo.xml @@ -2,7 +2,7 @@ - True + True

@@ -134,7 +134,7 @@ - True + True
@@ -267,7 +267,7 @@ - True + True
diff --git a/addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml b/addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml index c25a60b78f8..c6b97824cfb 100644 --- a/addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml +++ b/addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml @@ -398,7 +398,7 @@ /job-thank-you - True + True Thank you (Recruitment) qweb website_hr_recruitment.thankyou diff --git a/addons/website_membership/data/membership_demo.xml b/addons/website_membership/data/membership_demo.xml index 395dff2f03b..2aefbc27215 100644 --- a/addons/website_membership/data/membership_demo.xml +++ b/addons/website_membership/data/membership_demo.xml @@ -3,10 +3,10 @@ - + - + diff --git a/addons/website_partner/data/website_partner_data.xml b/addons/website_partner/data/website_partner_data.xml index c60a21e72a0..4adb17161e8 100644 --- a/addons/website_partner/data/website_partner_data.xml +++ b/addons/website_partner/data/website_partner_data.xml @@ -1,6 +1,6 @@ - True + True - \ No newline at end of file + diff --git a/addons/website_partner/data/website_partner_demo.xml b/addons/website_partner/data/website_partner_demo.xml index a139e80be94..f29bc76dc50 100644 --- a/addons/website_partner/data/website_partner_demo.xml +++ b/addons/website_partner/data/website_partner_demo.xml @@ -2,53 +2,53 @@ - True + True - True + True - True + True - True + True - True + True - True + True - True + True - True + True - True + True - True + True - True + True - True + True - True + True diff --git a/addons/website_rating/models/rating.py b/addons/website_rating/models/rating.py index 33184ca9051..1b5e99e3e62 100644 --- a/addons/website_rating/models/rating.py +++ b/addons/website_rating/models/rating.py @@ -7,6 +7,4 @@ class Rating(models.Model): _inherit = 'rating.rating' # Add this related field to mail.message for performance reason - # This field may one day be deplaced to another module (like 'website_rating') if it is required for - # another usage not related to website_sale. website_published = fields.Boolean(related='message_id.website_published', store=True, readonly=False) diff --git a/addons/website_sale/data/demo.xml b/addons/website_sale/data/demo.xml index d8eeb7ec088..d4752f1778e 100644 --- a/addons/website_sale/data/demo.xml +++ b/addons/website_sale/data/demo.xml @@ -6,56 +6,56 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + 2 2 9950 @@ -63,25 +63,25 @@ - + 10010 - + - + - + - + @@ -636,7 +636,7 @@ Warranty 20.0 9980 - + service diff --git a/addons/website_sale/tests/test_customize.py b/addons/website_sale/tests/test_customize.py index deab4212c5c..d120d7f6651 100644 --- a/addons/website_sale/tests/test_customize.py +++ b/addons/website_sale/tests/test_customize.py @@ -11,7 +11,7 @@ class TestUi(odoo.tests.HttpCase): # create a template product_template = self.env['product.template'].create({ 'name': 'Test Product', - 'website_published': True, + 'is_published': True, 'list_price': 750, }) @@ -147,7 +147,7 @@ class TestUi(odoo.tests.HttpCase): # create the template product_template = self.env['product.template'].create({ 'name': 'Test Product 2', - 'website_published': True, + 'is_published': True, }) # set attribute and attribute values on the template diff --git a/addons/website_sale/views/product_views.xml b/addons/website_sale/views/product_views.xml index 43284ead368..6b68b0e6ba4 100644 --- a/addons/website_sale/views/product_views.xml +++ b/addons/website_sale/views/product_views.xml @@ -7,7 +7,7 @@ - + diff --git a/addons/website_sale_delivery/data/website_sale_delivery_data.xml b/addons/website_sale_delivery/data/website_sale_delivery_data.xml index d77522880d0..67bedede367 100644 --- a/addons/website_sale_delivery/data/website_sale_delivery_data.xml +++ b/addons/website_sale_delivery/data/website_sale_delivery_data.xml @@ -1,6 +1,6 @@ - + diff --git a/addons/website_sale_delivery/data/website_sale_delivery_demo.xml b/addons/website_sale_delivery/data/website_sale_delivery_demo.xml index 39b3fa7892f..07c440824b3 100644 --- a/addons/website_sale_delivery/data/website_sale_delivery_demo.xml +++ b/addons/website_sale_delivery/data/website_sale_delivery_demo.xml @@ -3,11 +3,11 @@ - + - + diff --git a/addons/website_sale_delivery/views/website_sale_delivery_views.xml b/addons/website_sale_delivery/views/website_sale_delivery_views.xml index 7638048dba1..3ad54b1d01a 100644 --- a/addons/website_sale_delivery/views/website_sale_delivery_views.xml +++ b/addons/website_sale_delivery/views/website_sale_delivery_views.xml @@ -28,7 +28,7 @@ - + @@ -40,7 +40,7 @@ - + diff --git a/addons/website_sale_digital/data/product_demo.xml b/addons/website_sale_digital/data/product_demo.xml index 444ea7f5dc0..d8723d4a6c6 100644 --- a/addons/website_sale_digital/data/product_demo.xml +++ b/addons/website_sale_digital/data/product_demo.xml @@ -6,7 +6,7 @@ 2 4.50 service - + diff --git a/addons/website_sale_product_configurator/data/demo.xml b/addons/website_sale_product_configurator/data/demo.xml index db513297a7b..6697d426cb9 100644 --- a/addons/website_sale_product_configurator/data/demo.xml +++ b/addons/website_sale_product_configurator/data/demo.xml @@ -2,7 +2,7 @@ 9980 - + diff --git a/addons/website_sale_slides/data/website_sale_slides_demo.xml b/addons/website_sale_slides/data/website_sale_slides_demo.xml index f578264c907..57f4857dc6e 100644 --- a/addons/website_sale_slides/data/website_sale_slides_demo.xml +++ b/addons/website_sale_slides/data/website_sale_slides_demo.xml @@ -8,7 +8,7 @@ 100.0 100.0 service - + @@ -24,7 +24,7 @@ 12.0 12.0 consu - + @@ -33,7 +33,7 @@ 4.5 4.5 consu - + @@ -42,7 +42,7 @@ 150.0 150.0 service - + diff --git a/addons/website_sale_stock/data/website_sale_stock_demo.xml b/addons/website_sale_stock/data/website_sale_stock_demo.xml index 90789d7d481..5bcd5ed9640 100644 --- a/addons/website_sale_stock/data/website_sale_stock_demo.xml +++ b/addons/website_sale_stock/data/website_sale_stock_demo.xml @@ -1,7 +1,7 @@ - + diff --git a/addons/website_slides/controllers/main.py b/addons/website_slides/controllers/main.py index 57c25a04af0..634da160459 100644 --- a/addons/website_slides/controllers/main.py +++ b/addons/website_slides/controllers/main.py @@ -820,7 +820,7 @@ class WebsiteSlides(WebsiteProfile): try: values['user_id'] = request.env.uid - values['website_published'] = values.get('website_published', False) and can_publish + values['is_published'] = values.get('is_published', False) and can_publish slide = request.env['slide.slide'].sudo().create(values) except (UserError, AccessError) as e: _logger.error(e) @@ -836,17 +836,17 @@ class WebsiteSlides(WebsiteProfile): redirect_url += "?enable_editor=1" if slide.slide_type == "quiz": action_id = request.env.ref('website_slides.action_slides_slides').id - redirect_url = '/web#id=%s&action=%s&model=slide.slide&view_type=form' %(slide.id,action_id) + redirect_url = '/web#id=%s&action=%s&model=slide.slide&view_type=form' % (slide.id, action_id) return { 'url': redirect_url, 'channel_type': channel.channel_type, 'slide_id': slide.id, 'category_id': slide.category_id - } + } def _get_valid_slide_post_values(self): return ['name', 'url', 'tag_ids', 'slide_type', 'channel_id', 'is_preview', - 'mime_type', 'datas', 'description', 'image_1920', 'index_content', 'website_published'] + 'mime_type', 'datas', 'description', 'image_1920', 'index_content', 'is_published'] @http.route(['/slides/tag/search_read'], type='json', auth='user', methods=['POST'], website=True) def slide_tag_search_read(self, fields, domain): diff --git a/addons/website_slides/data/gamification_data.xml b/addons/website_slides/data/gamification_data.xml index 08606251fad..4cb9ce47af7 100644 --- a/addons/website_slides/data/gamification_data.xml +++ b/addons/website_slides/data/gamification_data.xml @@ -6,7 +6,7 @@ Get started Register to the platform - + bronze nobody @@ -47,7 +47,7 @@ Know yourself Complete your profile - + bronze nobody @@ -89,7 +89,7 @@ Power User Complete a course - + silver nobody @@ -129,7 +129,7 @@ Certified Knowledge Get a certification - + gold nobody @@ -170,7 +170,7 @@ Community hero Reach 2000 XP - + gold nobody diff --git a/addons/website_slides/data/slide_channel_demo.xml b/addons/website_slides/data/slide_channel_demo.xml index d88c30abe46..9e19e99d218 100644 --- a/addons/website_slides/data/slide_channel_demo.xml +++ b/addons/website_slides/data/slide_channel_demo.xml @@ -22,7 +22,7 @@ training latest - + documentation most_viewed - + training latest - + documentation most_voted - + @@ -120,7 +120,7 @@ will learn the basics of wood characteristics. training latest - + training most_voted - + Your Level - + Basic @@ -19,7 +19,7 @@ Your Role - + Gardener diff --git a/addons/website_slides/data/slide_data.xml b/addons/website_slides/data/slide_data.xml index 1490dfd5c05..e437c07e8f2 100644 --- a/addons/website_slides/data/slide_data.xml +++ b/addons/website_slides/data/slide_data.xml @@ -4,7 +4,7 @@ Our documentation most_viewed - + public Public access to presentations and documentation. @@ -12,7 +12,7 @@ Tags 20 - + diff --git a/addons/website_slides/data/slide_slide_demo.xml b/addons/website_slides/data/slide_slide_demo.xml index 3e329b38c28..d24b7edce73 100644 --- a/addons/website_slides/data/slide_slide_demo.xml +++ b/addons/website_slides/data/slide_slide_demo.xml @@ -11,7 +11,7 @@ presentation - + 10 2.5 @@ -25,7 +25,7 @@ infographic - + 5 1 @@ -42,7 +42,7 @@ infographic - + 5 0.5 @@ -56,7 +56,7 @@ infographic - + 5 1.5 @@ -70,7 +70,7 @@ infographic - + 10 1 @@ -96,7 +96,7 @@ video - + 0 1 @@ -145,7 +145,7 @@
- + 5 1 @@ -203,7 +203,7 @@ presentation - + 10 2.5 @@ -221,7 +221,7 @@ presentation - + 0 1 @@ -317,7 +317,7 @@
- + 0 2 @@ -332,7 +332,7 @@ video - + 0 1 @@ -350,7 +350,7 @@ presentation - + 10 2.5 @@ -377,7 +377,7 @@ - + 0 1 @@ -393,7 +393,7 @@ - + 5 3 @@ -403,10 +403,10 @@ Test your knowledge ! 4 - quiz + quiz - + 0 0.5 diff --git a/addons/website_slides/models/slide_channel.py b/addons/website_slides/models/slide_channel.py index 0b780567c0c..caf356b90ff 100644 --- a/addons/website_slides/models/slide_channel.py +++ b/addons/website_slides/models/slide_channel.py @@ -200,7 +200,7 @@ class Channel(models.Model): def _compute_slides_statistics(self): result = dict((cid, dict(total_views=0, total_votes=0, total_time=0)) for cid in self.ids) read_group_res = self.env['slide.slide'].read_group( - [('is_published', '=', True),('channel_id', 'in', self.ids)], + [('website_published', '=', True), ('channel_id', 'in', self.ids)], ['channel_id', 'slide_type', 'likes', 'dislikes', 'total_views', 'completion_time'], groupby=['channel_id', 'slide_type'], lazy=False) @@ -534,7 +534,7 @@ class Category(models.Model): def _count_presentations(self): result = dict.fromkeys(self.ids, dict()) res = self.env['slide.slide'].read_group( - [('is_published', '=', True), ('category_id', 'in', self.ids)], + [('website_published', '=', True), ('category_id', 'in', self.ids)], ['category_id', 'slide_type'], ['category_id', 'slide_type'], lazy=False) diff --git a/addons/website_slides/models/slide_slide.py b/addons/website_slides/models/slide_slide.py index d369a297afa..6cb8083536d 100644 --- a/addons/website_slides/models/slide_slide.py +++ b/addons/website_slides/models/slide_slide.py @@ -289,7 +289,7 @@ class Slide(models.Model): values['index_content'] = values.get('description') if values.get('slide_type') == 'infographic' and not values.get('image_1920'): values['image_1920'] = values['datas'] - if values.get('website_published') and not values.get('date_published'): + if values.get('is_published') and not values.get('date_published'): values['date_published'] = datetime.datetime.now() if values.get('url') and not values.get('document_id'): doc_data = self._parse_document_url(values['url']).get('values', dict()) @@ -298,7 +298,7 @@ class Slide(models.Model): slide = super(Slide, self).create(values) - if slide.website_published: + if slide.is_published: slide._post_publication() return slide @@ -309,7 +309,7 @@ class Slide(models.Model): values.setdefault(key, value) res = super(Slide, self).write(values) - if values.get('website_published'): + if values.get('is_published'): self.date_published = datetime.datetime.now() self._post_publication() return res diff --git a/addons/website_slides/static/src/js/slides_upload.js b/addons/website_slides/static/src/js/slides_upload.js index c5393f07087..0bb37736a7c 100644 --- a/addons/website_slides/static/src/js/slides_upload.js +++ b/addons/website_slides/static/src/js/slides_upload.js @@ -131,7 +131,7 @@ var SlideUploadDialog = Dialog.extend({ 'description': this._formGetFieldValue('description'), 'index_content': this._formGetFieldValue('index_content'), 'is_preview': this.$('#is_preview').is(':checked'), - 'website_published': forcePublished, + 'is_published': forcePublished, }, this._getSelect2DropdownValues()); // add tags and category // default slide_type (for webpage for instance) diff --git a/addons/website_slides/tests/common.py b/addons/website_slides/tests/common.py index 5be2442d96b..29d0405dec1 100644 --- a/addons/website_slides/tests/common.py +++ b/addons/website_slides/tests/common.py @@ -45,7 +45,7 @@ class SlidesCase(common.SavepointCase): 'promote_strategy': 'most_voted', 'enroll': 'public', 'visibility': 'public', - 'website_published': True, + 'is_published': True, 'karma_gen_channel_finish': 100, 'karma_gen_slide_vote': 5, 'karma_gen_channel_rank': 10, @@ -54,7 +54,7 @@ class SlidesCase(common.SavepointCase): 'name': 'How To Cook Humans', 'channel_id': self.channel.id, 'slide_type': 'presentation', - 'website_published': True, + 'is_published': True, 'completion_time': 2.0, }) diff --git a/addons/website_slides/tests/test_karma.py b/addons/website_slides/tests/test_karma.py index 43c390d8385..05cbaa9c981 100644 --- a/addons/website_slides/tests/test_karma.py +++ b/addons/website_slides/tests/test_karma.py @@ -19,7 +19,7 @@ class TestKarmaGain(common.SlidesCase): 'promote_strategy': 'most_voted', 'enroll': 'public', 'visibility': 'public', - 'website_published': True, + 'is_published': True, 'karma_gen_channel_finish': 100, 'karma_gen_slide_vote': 5, 'karma_gen_channel_rank': 10, @@ -29,14 +29,14 @@ class TestKarmaGain(common.SlidesCase): 'name': 'How to travel through space and time', 'channel_id': self.channel_2.id, 'slide_type': 'presentation', - 'website_published': True, + 'is_published': True, 'completion_time': 2.0, }) self.slide_2_1 = self.env['slide.slide'].with_user(self.user_publisher).create({ 'name': 'How to duplicate yourself', 'channel_id': self.channel_2.id, 'slide_type': 'presentation', - 'website_published': True, + 'is_published': True, 'completion_time': 2.0, }) diff --git a/addons/website_slides/tests/test_security.py b/addons/website_slides/tests/test_security.py index bbbb62bbef3..6cc498afaf4 100644 --- a/addons/website_slides/tests/test_security.py +++ b/addons/website_slides/tests/test_security.py @@ -66,7 +66,7 @@ class TestAccess(common.SlidesCase): @mute_logger('odoo.models', 'odoo.addons.base.models.ir_rule') def test_access_channel_publish(self): """ Unpublished channels and their content are visible only to website people """ - self.channel.write({'website_published': False, 'enroll': 'public'}) + self.channel.write({'is_published': False, 'enroll': 'public'}) # channel available only to website self.channel.with_user(self.user_publisher).read(['name']) @@ -97,10 +97,10 @@ class TestAccess(common.SlidesCase): self.slide.with_user(self.user_emp).read(['name']) # publish channel but content unpublished (even if can be previewed) still unavailable - self.channel.write({'website_published': True}) + self.channel.write({'is_published': True}) self.slide.write({ 'is_preview': True, - 'website_published': False, + 'is_published': False, }) self.slide.with_user(self.user_publisher).read(['name']) @@ -134,7 +134,7 @@ class TestAccessFeatures(common.SlidesCase): channel = self.env['slide.channel'].create({ 'name': 'Test', 'enroll': 'invite', - 'website_published': True, + 'is_published': True, 'enroll_group_ids': [(4, self.ref('base.group_user'))] }) diff --git a/addons/website_slides/tests/test_statistics.py b/addons/website_slides/tests/test_statistics.py index 5321eb0c611..b602679e864 100644 --- a/addons/website_slides/tests/test_statistics.py +++ b/addons/website_slides/tests/test_statistics.py @@ -21,14 +21,14 @@ class TestStatistics(common.SlidesCase): 'name': 'How To Cook For Humans', 'channel_id': self.channel.id, 'slide_type': 'presentation', - 'website_published': True, + 'is_published': True, 'completion_time': 3.0, }) self.slide_3 = self.env['slide.slide'].with_user(self.user_publisher).create({ 'name': 'How To Cook Humans For Humans', 'channel_id': self.channel.id, 'slide_type': 'document', - 'website_published': True, + 'is_published': True, 'completion_time': 1.5, }) diff --git a/addons/website_slides/views/slide_channel_tag_views.xml b/addons/website_slides/views/slide_channel_tag_views.xml index e2b91f38853..ee838298a61 100644 --- a/addons/website_slides/views/slide_channel_tag_views.xml +++ b/addons/website_slides/views/slide_channel_tag_views.xml @@ -63,9 +63,14 @@
+
+ +
-
@@ -79,7 +84,7 @@ - +
diff --git a/addons/website_slides/views/slide_slide_views.xml b/addons/website_slides/views/slide_slide_views.xml index 5fcb30dbad4..e380ba4abb8 100644 --- a/addons/website_slides/views/slide_slide_views.xml +++ b/addons/website_slides/views/slide_slide_views.xml @@ -186,8 +186,8 @@ - - + + diff --git a/addons/website_slides_survey/data/gamification_data.xml b/addons/website_slides_survey/data/gamification_data.xml index 8135cabca80..ea7153b796f 100644 --- a/addons/website_slides_survey/data/gamification_data.xml +++ b/addons/website_slides_survey/data/gamification_data.xml @@ -1,7 +1,7 @@ - + [ diff --git a/addons/website_slides_survey/data/slide_slide_demo.xml b/addons/website_slides_survey/data/slide_slide_demo.xml index bf9cc7c95f9..b3ece42ffca 100644 --- a/addons/website_slides_survey/data/slide_slide_demo.xml +++ b/addons/website_slides_survey/data/slide_slide_demo.xml @@ -11,7 +11,7 @@ - + Now that you have completed the course, it's time to test your knowledge! @@ -26,7 +26,7 @@ - + It's time to test your knowledge!
diff --git a/addons/website_slides_survey/tests/test_course_certification_failure.py b/addons/website_slides_survey/tests/test_course_certification_failure.py index c578b763010..8ddf8ffdab8 100644 --- a/addons/website_slides_survey/tests/test_course_certification_failure.py +++ b/addons/website_slides_survey/tests/test_course_certification_failure.py @@ -45,7 +45,7 @@ class TestCourseCertificationFailureFlow(SurveyCase): 'channel_type': 'training', 'enroll': 'public', 'visibility': 'public', - 'website_published': True, + 'is_published': True, }) # Step 2: link the certification to a slide of type 'certification' @@ -54,7 +54,7 @@ class TestCourseCertificationFailureFlow(SurveyCase): 'channel_id': self.channel.id, 'slide_type': 'certification', 'survey_id': certification.id, - 'website_published': True, + 'is_published': True, }) # Step 3: add public user as member of the channel self.channel._action_add_members(self.user_public.partner_id) diff --git a/doc/howtos/website/course-product b/doc/howtos/website/course-product index 252241150ec..aa9dc716b49 100644 --- a/doc/howtos/website/course-product +++ b/doc/howtos/website/course-product @@ -35,7 +35,7 @@ diff --git a/academy/demo.xml b/academy/demo.xml + Course 0 + + -+ True ++ True + 0 + service + @@ -43,7 +43,7 @@ diff --git a/academy/demo.xml b/academy/demo.xml + Course 1 + + -+ True ++ True + 0 + service + @@ -51,7 +51,7 @@ diff --git a/academy/demo.xml b/academy/demo.xml + Course 2 + + -+ True ++ True + 0 + service +