[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) <nim@odoo.com>
This commit is contained in:
Juhil Somaiya
2019-05-29 08:39:13 +00:00
committed by Nicolas Martinelli
parent 9aac7c9286
commit 1f3a00fb3e
+4 -4
View File
@@ -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']