From e8019a23c2d83d77e4b4a45cd56894e2397abc4d Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Tue, 20 Dec 2016 21:08:28 +0100 Subject: [PATCH] [FIX] calendar: fix end recurrency date for yearly event Event with interval > 1 was not correctly computed. This patch doesn't fix existing event but only the new one created after this fix. Event 1/1/2015 repeat every 3 months, 6 times Before this commit : end recurrency = 1/1/2015 + 6 * 1 month After this commit: end recurrency = 1/1/2015 + 6 * 1 month * 3 (interval) This commit closes #14332 --- addons/calendar/calendar.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/calendar/calendar.py b/addons/calendar/calendar.py index 75b79922c5a..b5b0e073d16 100644 --- a/addons/calendar/calendar.py +++ b/addons/calendar/calendar.py @@ -720,15 +720,15 @@ class calendar_event(osv.Model): return [d.astimezone(pytz.UTC) for d in rset1] def _get_recurrency_end_date(self, cr, uid, id, context=None): - data = self.read(cr, uid, id, ['final_date', 'recurrency', 'rrule_type', 'count', 'end_type', 'stop'], context=context) + data = self.read(cr, uid, id, ['final_date', 'recurrency', 'rrule_type', 'count', 'end_type', 'stop', 'interval'], context=context) if not data.get('recurrency'): return False end_type = data.get('end_type') final_date = data.get('final_date') - if end_type == 'count' and all(data.get(key) for key in ['count', 'rrule_type', 'stop']): - count = data['count'] + 1 + if end_type == 'count' and all(data.get(key) for key in ['count', 'rrule_type', 'stop', 'interval']): + count = (data['count'] + 1) * data['interval'] delay, mult = { 'daily': ('days', 1), 'weekly': ('days', 7),