[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
This commit is contained in:
Denis Ledoux 2017-01-12 18:27:17 +01:00
parent bf38fe4c5f
commit 0a5c5c6c9d
1 changed files with 5 additions and 5 deletions

View File

@ -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):