[IMP]: Caldav: Improvement for importing project task with duration propery

bzr revid: rpa@tinyerp.com-20091221133604-ot8dez1yevae71hp
This commit is contained in:
rpa (Open ERP)
2009-12-21 19:06:04 +05:30
parent 1e1c996161
commit f50f8d71b8
3 changed files with 12 additions and 5 deletions
+3 -1
View File
@@ -126,6 +126,8 @@ class CalDAV(object):
elif map_type == 'datetime' and data[map_field]:
vevent.add(field).value = datetime.strptime(data[map_field], \
"%Y-%m-%d %H:%M:%S")
elif map_type == "timedelta":
vevent.add(field).value = timedelta(hours=data[map_field])
if self.__attribute__.get(field).has_key('mapping'):
for key1, val1 in self.ical_get(field, 'mapping').items():
if val1 == data[map_field]:
@@ -151,7 +153,7 @@ class CalDAV(object):
if cal_data.name.lower() in self.__attribute__:
self.ical_set(cal_data.name.lower(), cal_data.value, 'value')
vals = map_data(cr, uid, self)
if vals : res.append(vals)
if vals: res.append(vals)
self.ical_reset('value')
return res
+1 -1
View File
@@ -204,7 +204,7 @@ virtual_report_spool()
class virtual_wizard(web_services.wizard):
def exp_execute(self, db, uid, wiz_id, datas, action='init', context=None):
if wiz_id not in self.wiz_uid:
# TODO : To Check why need it
# TODO: To Check why need it
if wiz_id == 1:
wiz_name ='base_setup.base_setup'
if wiz_id == 2:
+8 -3
View File
@@ -66,7 +66,7 @@ class project_task(osv.osv):
'description': {'field': 'description', 'type': 'text'},
# 'dtstamp': {'field': 'field', 'type': 'text'},
'dtstart': {'field': 'date_start', 'type': 'datetime'},
'duration': {'field': 'planned_hours', 'type': 'int'},
'duration': {'field': 'planned_hours', 'type': 'timedelta'},
'due': {'field': 'date_deadline', 'type': 'datetime'},
# 'geo': {'field': 'field', 'type': 'text'},
# 'last-mod ': {'field': 'field', 'type': 'text'},
@@ -112,9 +112,14 @@ class project_task(osv.osv):
vals = todo_obj.import_ical(cr, uid, file_content)
for val in vals:
if not val.has_key('duration'):
# 'Compute duration'
obj_tm = self.pool.get('res.users').browse(cr, uid, uid, context).company_id.project_time_mode_id
if not val.has_key('planned_hours'):
# 'Compute duration' in days
val['planned_hours'] = 16
else:
# Convert timedelta into Project time unit
val['planned_hours'] = (val['planned_hours'].seconds/float(86400) + \
val['planned_hours'].days) * obj_tm.factor
val.pop('id')
task_id = self.create(cr, uid, val)
return {'count': len(vals)}