diff --git a/addons/calendar/calendar.py b/addons/calendar/calendar.py index cead6d230a9..00c82af60db 100644 --- a/addons/calendar/calendar.py +++ b/addons/calendar/calendar.py @@ -825,6 +825,11 @@ class calendar_event(osv.Model): meeting_data[field] = meeting.stop_date if meeting.allday else meeting.stop_datetime return res + def _get_recurrent_fields(self, cr, uid, context=None): + return ['byday', 'recurrency', 'final_date', 'rrule_type', 'month_by', + 'interval', 'count', 'end_type', 'mo', 'tu', 'we', 'th', 'fr', 'sa', + 'su', 'day', 'week_list'] + def _get_rulestring(self, cr, uid, ids, name, arg, context=None): """ Gets Recurrence rule string according to value type RECUR of iCalendar from the values given. @@ -835,10 +840,8 @@ class calendar_event(osv.Model): ids = [ids] #read these fields as SUPERUSER because if the record is private a normal search could raise an error - events = self.read(cr, SUPERUSER_ID, ids, - ['id', 'byday', 'recurrency', 'final_date', 'rrule_type', 'month_by', - 'interval', 'count', 'end_type', 'mo', 'tu', 'we', 'th', 'fr', 'sa', - 'su', 'day', 'week_list'], context=context) + recurrent_fields = self._get_recurrent_fields(cr, uid, context=context) + events = self.read(cr, SUPERUSER_ID, ids, recurrent_fields, context=context) for event in events: if event['recurrency']: result[event['id']] = self.compute_rule_string(event) diff --git a/addons/google_calendar/google_calendar.py b/addons/google_calendar/google_calendar.py index e9debc8f1bb..8f990ea075e 100644 --- a/addons/google_calendar/google_calendar.py +++ b/addons/google_calendar/google_calendar.py @@ -989,9 +989,10 @@ class calendar_event(osv.Model): _inherit = "calendar.event" def get_fields_need_update_google(self, cr, uid, context=None): - return ['name', 'description', 'allday', 'start', 'date_end', 'stop', - 'attendee_ids', 'alarm_ids', 'location', 'class', 'active', - 'start_date', 'start_datetime', 'stop_date', 'stop_datetime'] + recurrent_fields = self._get_recurrent_fields(cr, uid, context=context) + return recurrent_fields + ['name', 'description', 'allday', 'start', 'date_end', 'stop', + 'attendee_ids', 'alarm_ids', 'location', 'class', 'active', + 'start_date', 'start_datetime', 'stop_date', 'stop_datetime'] def write(self, cr, uid, ids, vals, context=None): if context is None: