[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
This commit is contained in:
Jeremy Kersten 2016-12-20 21:08:28 +01:00
parent 659d68add5
commit e8019a23c2
1 changed files with 3 additions and 3 deletions

View File

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