summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuhil Somaiya <jso@odoo.com>2019-03-07 08:37:36 +0000
committerNicolas Martinelli <nim@odoo.com>2019-05-29 08:39:13 +0000
commit1f3a00fb3e5c7c9a90776a8a13b1f83e8b3e25bd (patch)
tree82216f1a23d9a11c661064c2eac9567ed4392465
parent9aac7c92861ae7af031fdc15e4c8a66760edfabb (diff)
[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>
-rw-r--r--addons/calendar/models/calendar.py8
1 files 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']