[IMP]: caldav, crm: Improvement for importing/exporting proper data

bzr revid: rpa@openerp.co.in-20100108093324-dbopuq81aif61dbi
This commit is contained in:
rpa (Open ERP)
2010-01-08 15:03:24 +05:30
parent da65f9b1a1
commit 0e4457b63b
2 changed files with 7 additions and 5 deletions
+3 -1
View File
@@ -61,7 +61,7 @@ def map_data(cr, uid, obj):
continue
if field_type == 'many2one':
id = None
if not map_val:
if not map_val or not isinstance(map_val, dict):
vals[field] = id
continue
model = obj.__attribute__[map_dict].get('object', False)
@@ -144,6 +144,8 @@ class CalDAV(object):
vevent.add(field).value = parser.parse(data[map_field])
elif map_type == "timedelta":
vevent.add(field).value = timedelta(hours=data[map_field])
elif map_type == "many2one":
vevent.add(field).value = [data.get(map_field)[1]]
if self.__attribute__.get(field).has_key('mapping'):
for key1, val1 in self.ical_get(field, 'mapping').items():
if val1 == data[map_field]:
+4 -4
View File
@@ -54,7 +54,7 @@ class crm_meeting(osv.osv):
# 'attach': {'field': 'attachment_ids', 'sub-field': 'datas', 'type': 'list'},
'attendee': {'field': 'attendee_ids', 'type': 'many2many', 'object': 'calendar.attendee'},
# 'categories': {'field': 'categ_id', 'sub-field': 'name'},
# 'categories': {'field':None , 'sub-field': 'name', 'type': 'text'},
'categories': {'field': 'categ_id', 'type': 'many2one', 'object': 'crm.case.categ'},
'comment': None,
'contact': None,
'exdate' : {'field': 'exdate', 'type': 'datetime'},
@@ -66,7 +66,7 @@ class crm_meeting(osv.osv):
'rrule': {'field': 'rrule', 'type': 'text'},
'x-openobject-model': {'value': _name, 'type': 'text'},
# 'duration': {'field': 'duration'},
'dtend': {'field': 'date_closed', 'type': 'datetime'},
'dtend': {'field': 'date_deadline', 'type': 'datetime'},
'valarm': {'field': 'caldav_alarm_id', 'type': 'many2one', 'object': 'calendar.alarm'},
}
@@ -227,12 +227,12 @@ class crm_meeting(osv.osv):
if val['caldav_alarm_id']:
cal_alarm = self.browse(cr, uid, case_id).caldav_alarm_id
alarm_id = cal_alarm.alarm_id and cal_alarm.alarm_id.id or False
self.write(cr, uid, [case_id], {'alarm_id': alarm_id})
self.write(cr, uid, [case_id], {'alarm_id': alarm_id})
return {'count': len(vals)}
def get_recurrent_ids(self, cr, uid, ids, start_date, until_date, limit=100):
if not limit:
limit = 100
limit = 100
if ids and (start_date or until_date):
cr.execute("select m.id, m.rrule, c.date, m.exdate from crm_meeting m\
join crm_case c on (c.id=m.inherit_case_id) \