[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
This commit is contained in:
Noé Antoine
2022-02-28 11:07:38 +00:00
committed by Thibault Delavallée
parent 57be5167a9
commit ffa2ed0e75
@@ -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):