From b3c00f5e4fbef1c3f17a866d52c2309f50cb5bc4 Mon Sep 17 00:00:00 2001 From: "ACH,JVO" <> Date: Fri, 3 Jul 2009 11:38:23 +0530 Subject: [PATCH] [FIX] Export will consider float values as float and char as char lp bug: https://launchpad.net/bugs/357945 fixed bzr revid: jvo@tinyerp.com-20090703060823-5aupesiimak1bb7x --- bin/osv/orm.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index e230c65ebbd..1686d4451b0 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -433,6 +433,16 @@ class orm_template(object): return browse_null() def __export_row(self, cr, uid, row, fields, context=None): + + def check_type(type,r): + if type == 'float': + return 0.0 + elif type == 'integer': + return 0 + elif type == 'char': + return '' + return r + lines = [] data = map(lambda x: '', range(len(fields))) done = [] @@ -444,6 +454,12 @@ class orm_template(object): while i < len(f): r = r[f[i]] if not r: + if f[i] in self._columns: + r = check_type(self._columns[f[i]]._type,r) + elif f[i] in self._inherit_fields: + r = check_type(self._inherit_fields[f[i]][2]._type,r) + + data[fpos] = r break if isinstance(r, (browse_record_list, list)): first = True