From 1f3a00fb3e5c7c9a90776a8a13b1f83e8b3e25bd Mon Sep 17 00:00:00 2001 From: Juhil Somaiya Date: Thu, 7 Mar 2019 08:37:36 +0000 Subject: [PATCH] [FIX] calendar: traceback on recurrent meetings when repetition number is 0 If the user tries to save the recurrent event with 0 as the number of repitations or interval there will be a traceback so instead of traceback display the warning so user will not be able to save that event. Task-1930809 closes odoo/odoo#31388 Signed-off-by: Nicolas Martinelli (nim) --- addons/calendar/models/calendar.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/calendar/models/calendar.py b/addons/calendar/models/calendar.py index ce9a0453dd5..dfb22c53c0e 100644 --- a/addons/calendar/models/calendar.py +++ b/addons/calendar/models/calendar.py @@ -1238,10 +1238,10 @@ class Meeting(models.Model): """ Compute rule string according to value type RECUR of iCalendar :return: string containing recurring rule (empty if no rule) """ - if self.interval and self.interval < 0: - raise UserError(_('interval cannot be negative.')) - if self.count and self.count <= 0: - raise UserError(_('Event recurrence interval cannot be negative.')) + if self.interval <= 0: + raise UserError(_('The interval cannot be negative.')) + if self.end_type == 'count' and self.count <= 0: + raise UserError(_('The number of repetitions cannot be negative.')) def get_week_string(freq): weekdays = ['mo', 'tu', 'we', 'th', 'fr', 'sa', 'su']