diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 584762828f1..82ceb2aab70 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -38,7 +38,7 @@ months = { def get_recurrent_dates(rrulestring, exdate, startdate=None): def todate(date): - val = parser.parse(''.join((re.compile('\d')).findall(date)) + 'Z') + val = parser.parse(''.join((re.compile('\d')).findall(date))) return val if not startdate: startdate = datetime.now() @@ -778,13 +778,15 @@ rule or repeating pattern for anexception to a recurrence set"), def modify_this(self, cr, uid, ids, defaults, context=None, *args): datas = self.read(cr, uid, ids[0], context=context) - date = datas.get('date') defaults.update({ 'recurrent_uid': base_calendar_id2real_id(datas['id']), 'recurrent_id': defaults.get('date'), 'rrule_type': 'none', 'rrule': '' }) + exdate = datas['exdate'] and datas['exdate'].split(',') or [] + exdate.append(defaults.get('date')) + self.write(cr, uid, ids, {'exdate': ','.join(exdate)}, context=context) new_id = self.copy(cr, uid, ids[0], default=defaults, context=context) return new_id diff --git a/addons/caldav/caldav.py b/addons/caldav/caldav.py index 6c416903959..48f845176d4 100644 --- a/addons/caldav/caldav.py +++ b/addons/caldav/caldav.py @@ -248,15 +248,15 @@ class CalDAV(object): data[map_field], ical, context=context) elif data[map_field]: if map_type in ("char", "text"): - vevent.add(field).value = tools.ustr(data[map_field]) - elif map_type in ('datetime', 'date') and data[map_field]: if field in ('exdate'): - vevent.add(field).value = [parser.parse(data[map_field])] + vevent.add(field).value = map(parser.parse, (data[map_field]).split(',')) else: - dtfield = vevent.add(field) - dtfield.value = parser.parse(data[map_field]) - if tzval: - dtfield.params['TZID'] = [tzval.title()] + vevent.add(field).value = tools.ustr(data[map_field]) + elif map_type in ('datetime', 'date') and data[map_field]: + dtfield = vevent.add(field) + dtfield.value = parser.parse(data[map_field]) + if tzval: + dtfield.params['TZID'] = [tzval.title()] elif map_type == "timedelta": vevent.add(field).value = timedelta(hours=data[map_field]) elif map_type == "many2one": @@ -275,11 +275,13 @@ class CalDAV(object): def check_import(self, cr, uid, vals, context={}): ids = [] model_obj = self.pool.get(context.get('model')) + recur_pool = {} try: for val in vals: exists, r_id = uid2openobjectid(cr, val['id'], context.get('model'), \ val.get('recurrent_id')) if val.has_key('create_date'): val.pop('create_date') + u_id = val.get('id', None) val.pop('id') if exists and r_id: val.update({'recurrent_uid': exists}) @@ -289,8 +291,14 @@ class CalDAV(object): model_obj.write(cr, uid, [exists], val) ids.append(exists) else: - event_id = model_obj.create(cr, uid, val) - ids.append(event_id) + if u_id in recur_pool and val.get('recurrent_id'): + val.update({'recurrent_uid': recur_pool[u_id]}) + revent_id = model_obj.create(cr, uid, val) + ids.append(revent_id) + else: + event_id = model_obj.create(cr, uid, val) + recur_pool[u_id] = event_id + ids.append(event_id) except Exception, e: raise osv.except_osv(('Error !'), (str(e))) return ids @@ -369,6 +377,7 @@ class Calendar(CalDAV, osv.osv): def import_cal(self, cr, uid, content, data_id=None, context=None): if not context: context = {} + vals = [] ical_data = base64.decodestring(content) parsedCal = vobject.readOne(ical_data) if not data_id: @@ -385,11 +394,12 @@ class Calendar(CalDAV, osv.osv): }) self.__attribute__ = get_attribute_mapping(cr, uid, child.name.lower(), context=context) val = self.parse_ics(cr, uid, child, cal_children=cal_children, context=context) + vals.append(val) obj = self.pool.get(cal_children[child.name.lower()]) - if hasattr(obj, 'check_import'): - obj.check_import(cr, uid, [val], context=context) - else: - self.check_import(cr, uid, [val], context=context) + if hasattr(obj, 'check_import'): + obj.check_import(cr, uid, vals, context=context) + else: + self.check_import(cr, uid, vals, context=context) return {} Calendar() diff --git a/addons/crm/crm_fund_view.xml b/addons/crm/crm_fund_view.xml index 250f7473592..f7a45b1f082 100644 --- a/addons/crm/crm_fund_view.xml +++ b/addons/crm/crm_fund_view.xml @@ -37,7 +37,7 @@ - + @@ -197,7 +197,7 @@ - + - - + diff --git a/addons/sale/report_sale_view.xml b/addons/sale/report_sale_view.xml index 28749e8b672..286a529cf82 100644 --- a/addons/sale/report_sale_view.xml +++ b/addons/sale/report_sale_view.xml @@ -85,13 +85,5 @@ - - - - - - - - - \ No newline at end of file + diff --git a/addons/scrum/scrum_view.xml b/addons/scrum/scrum_view.xml index ca762af4955..9706103127f 100644 --- a/addons/scrum/scrum_view.xml +++ b/addons/scrum/scrum_view.xml @@ -78,7 +78,7 @@ - + @@ -103,7 +103,7 @@ @@ -184,17 +184,17 @@ - + - + - + @@ -456,7 +456,7 @@ - + diff --git a/addons/scrum/wizard/backlog_to_task.py b/addons/scrum/wizard/backlog_to_task.py index 295ec6c1d5f..65795906765 100644 --- a/addons/scrum/wizard/backlog_to_task.py +++ b/addons/scrum/wizard/backlog_to_task.py @@ -48,7 +48,7 @@ def _do_create(self, cr, uid, data, context): 'name': backlog.name, 'description': backlog.note, 'project_id': backlog.project_id.id, - 'user_id': (backlog.user_id and backlog.user_id.id) or uid, + 'user_id': data['form']['user_id'] or (backlog.user_id and backlog.user_id.id) or uid, 'planned_hours': backlog.planned_hours }))