From ffa2ed0e752c0b48c407792e6b251920f546eb0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Antoine?= Date: Wed, 23 Feb 2022 08:35:20 +0000 Subject: [PATCH] [IMP] website_slides: add constraint completion to be a percentage Before completion could hold about any value, even if it is generally correctly computed as a percentage. To be sure we don't have incoherent values in db a constraint is added to ensure completion is contained between 0 and 100. --- Links --- Task-2777216 Prepares Task-2508019 (Slides membership refactoring) Also see UPG PR - odoo/upgrade#2854 Part-of: odoo/odoo#74171 --- addons/website_slides/models/slide_channel.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/website_slides/models/slide_channel.py b/addons/website_slides/models/slide_channel.py index 402222f0e8b..28e85a4fada 100644 --- a/addons/website_slides/models/slide_channel.py +++ b/addons/website_slides/models/slide_channel.py @@ -39,6 +39,10 @@ class ChannelUsersRelation(models.Model): 'unique(channel_id, partner_id)', 'A partner membership to a channel must be unique!' ), + ('check_completion', + 'check(completion >= 0 and completion <= 100)', + 'The completion of a channel is a percentage and should be between 0% and 100.' + ) ] def _recompute_completion(self):