[FIX] calendar: avoid infinite recurrent event
Old check was always ignored since 0 is False. This commit closes #12715 Other fix; when we detach an event, we reset the rrule_type to avoid to have a warning popup (about empty final_date) if the old one value was end_date.
This commit is contained in:
parent
8245c1d1d8
commit
3418b9f8aa
|
@ -1267,7 +1267,7 @@ class calendar_event(osv.Model):
|
|||
"""
|
||||
if data['interval'] and data['interval'] < 0:
|
||||
raise osv.except_osv(_('warning!'), _('interval cannot be negative.'))
|
||||
if data['count'] and data['count'] <= 0:
|
||||
if data['end_type'] == 'count' and int(data['count']) <= 0:
|
||||
raise osv.except_osv(_('warning!'), _('count cannot be negative or 0.'))
|
||||
|
||||
def get_week_string(freq, data):
|
||||
|
@ -1537,6 +1537,7 @@ class calendar_event(osv.Model):
|
|||
recurrent_id=real_event_id,
|
||||
recurrent_id_date=data.get('start'),
|
||||
rrule_type=False,
|
||||
end_type=False,
|
||||
rrule='',
|
||||
recurrency=False,
|
||||
final_date=datetime.strptime(data.get('start'), DEFAULT_SERVER_DATETIME_FORMAT if data['allday'] else DEFAULT_SERVER_DATETIME_FORMAT) + timedelta(hours=values.get('duration', False) or data.get('duration'))
|
||||
|
|
Loading…
Reference in New Issue