[FIX] convert datetime to date in case of date field

bzr revid: mat@openerp.com-20140401100819-k092i48lefozmdxb
This commit is contained in:
Martin Trigaux 2014-04-01 12:08:19 +02:00
parent cf1f20e5d5
commit 7d585c5dad
1 changed files with 2 additions and 1 deletions

View File

@ -1215,6 +1215,7 @@ class BaseModel(object):
lines += lines2
break
i += 1
if i == len(f):
if isinstance(r, browse_record):
r = self.pool[r._table_name].name_get(cr, uid, [r.id], context=context)
@ -1222,7 +1223,7 @@ class BaseModel(object):
if raw_data and cols and cols._type in ('integer', 'boolean', 'float'):
data[fpos] = r
elif raw_data and cols and cols._type == 'date':
data[fpos] = datetime.datetime.strptime(r, tools.DEFAULT_SERVER_DATE_FORMAT)
data[fpos] = datetime.datetime.strptime(r, tools.DEFAULT_SERVER_DATE_FORMAT).date()
elif raw_data and cols and cols._type == 'datetime':
data[fpos] = datetime.datetime.strptime(r, tools.DEFAULT_SERVER_DATETIME_FORMAT)
else: