From bf3ed3fc7c2cbfacd2d00e9fd2dbc2edb8ce3c29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Warnon?= Date: Tue, 30 Apr 2019 08:27:56 +0000 Subject: [PATCH] [FIX] website_slides: fix courses completion on user profile page This commit fixes the courses (slide.channel) completion displayed on the user profile page. It uses the number of completed slides instead of the percentage of completion. This is due to the completion field having been updated recently to store number of completed slides instead of a computed percentage for performances reasons [1] Commit linked to task ID 1978530 (fixes linked to internal testing). [1] See 534822e54c44ba9048de2d8b22675d1adefeaf80 --- addons/website_slides/models/slide_channel.py | 3 +-- .../views/website_slides_templates_profile.xml | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/website_slides/models/slide_channel.py b/addons/website_slides/models/slide_channel.py index f504ecc03fd..28b53c89dec 100644 --- a/addons/website_slides/models/slide_channel.py +++ b/addons/website_slides/models/slide_channel.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -import math import uuid from odoo import api, fields, models, tools, _ @@ -237,7 +236,7 @@ class Channel(models.Model): for record in self: completed, completion = mapped_data.get(record.id, (False, 0)) record.completed = completed - record.completion = math.ceil(100.0 * completion / (record.total_slides or 1)) + record.completion = round(100.0 * completion / (record.total_slides or 1)) @api.depends('upload_group_ids', 'user_id') def _compute_can_upload(self): diff --git a/addons/website_slides/views/website_slides_templates_profile.xml b/addons/website_slides/views/website_slides_templates_profile.xml index 8fbfd413f55..262c95a7717 100644 --- a/addons/website_slides/views/website_slides_templates_profile.xml +++ b/addons/website_slides/views/website_slides_templates_profile.xml @@ -33,6 +33,8 @@