From ff0d28f71f3b4f666beb459c85d0c4fe833967e4 Mon Sep 17 00:00:00 2001 From: jke-openerp Date: Tue, 26 Nov 2013 21:52:23 +0100 Subject: [PATCH] [FIX] Fix bug with recurrent event on create. Add call to function to know the end date since it possible to add a recurrent meeting on Create also. (Before, only on write). bzr revid: jke@openerp.com-20131126205223-wovuhdtq82ck4q8c --- addons/base_calendar/base_calendar.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index be9459f50e7..ea6973ff86f 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -1535,14 +1535,15 @@ class crm_meeting(osv.Model): # new_args += ['|','&',('recurrency','=',1),('date_deadline', arg[1], arg[2])] elif arg[0] in ('date', unicode('date')): if context.get('virtual_id', True): - new_args += ['|','&',('recurrency','=',1),('end_date', arg[1], arg[2])] + print '' + #new_args += ['|','&',('recurrency','=',1),('end_date', arg[1], arg[2])] # new_args += ['|','&',('recurrency','=',1),('date_deadline', arg[1], arg[2])] elif arg[0] == "id": new_id = get_real_ids(arg[2]) new_arg = (arg[0], arg[1], new_id) new_args.append(new_arg) #offset, limit and count must be treated separately as we may need to deal with virtual ids - #print 'AFTER SEARCH',new_args + print 'AFTER SEARCH',new_args res = super(crm_meeting,self).search(cr, uid, new_args, offset=0, limit=0, order=order, context=context, count=False) @@ -1655,13 +1656,13 @@ class crm_meeting(osv.Model): if context is None: context = {} -# if vals.get('duration', '') and vals.get('duration', '')==24 and not 'allday' in vals: #If from quick create -# vals['allday'] = True - if not 'user_id' in vals: #Else bug with quick_create when we are filter on an other user vals['user_id'] = uid - + if vals.get('recurrency', True) and vals.get('end_type', 'count') in ('count', unicode('count')) and \ + (vals.get('rrule_type') or vals.get('count') or vals.get('date') or vals.get('date_deadline')): + vals['end_date'] = self._get_recurrency_end_date(vals, context=context) + res = super(crm_meeting, self).create(cr, uid, vals, context=context) #res = self.write(cr, uid, id_res,vals, context)