From 0a5c5c6c9db479522b1b6f78c2cf0e1edd583a3a Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 12 Jan 2017 18:27:17 +0100 Subject: [PATCH] [FIX] calendar: final date recomputation trigger With the previous condition, the `final_date` was not recomputed when the number of repetitions (count) was changed alone, without changing `recurrency` (nor with other fields, such as start/stop date) This revision makes sure to recompute the `final_date` when there is a change in the number of repetitions without changing the `recurrency` fields, when the event is recurrency and the end type is `count` opw-703812 --- addons/calendar/calendar.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/calendar/calendar.py b/addons/calendar/calendar.py index da6c14d2346..8e6896f920d 100644 --- a/addons/calendar/calendar.py +++ b/addons/calendar/calendar.py @@ -1606,11 +1606,11 @@ class calendar_event(osv.Model): super(calendar_event, self).write(cr, uid, real_ids, values, context=context) # set end_date for calendar searching - if values.get('recurrency') and values.get('end_type', 'count') in ('count', unicode('count')) and \ - (values.get('rrule_type') or values.get('count') or values.get('start') or values.get('stop')): - for id in real_ids: - final_date = self._get_recurrency_end_date(cr, uid, id, context=context) - super(calendar_event, self).write(cr, uid, [id], {'final_date': final_date}, context=context) + if any(field in values for field in ['recurrency', 'end_type', 'count', 'rrule_type', 'start', 'stop']): + for event in self.browse(cr, uid, real_ids, context=context): + if event.recurrency and event.end_type in ('count', unicode('count')): + final_date = self._get_recurrency_end_date(cr, uid, event.id, context=context) + super(calendar_event, self).write(cr, uid, [event.id], {'final_date': final_date}, context=context) attendees_create = False if values.get('partner_ids', False):