return result
def _parse_string(self, view):
- dom = etree.XML(unicode(view, 'utf-8').encode('utf-8'))
+ dom = etree.XML(view)
return self._parse_node(dom)
def create(self, cr, uid, ids, datas, context=None):
count = len(fields_order)
for i in range(0,count):
tsum.append(0)
-
+
for line in results:
node_line = etree.Element("row")
count = -1
for f in fields_order:
-
+ float_flag = 0
count += 1
if fields[f]['type']=='many2one' and line[f]:
if fields[f]['type'] == 'float' and line[f]:
precision=(('digits' in fields[f]) and fields[f]['digits'][1]) or 2
- line[f]='%.2f'%(line[f])
+ prec ='%.' + str(precision) +'f'
+ line[f]=prec%(line[f])
+ float_flag = 1
if fields[f]['type'] == 'date' and line[f]:
format = str(locale.nl_langinfo(locale.D_FMT).replace('%y', '%Y'))
col.set('tree','no')
if line[f] != None:
col.text = tools.ustr(line[f] or '')
+ if float_flag:
+ col.set('tree','float')
if temp[count] == 1:
tsum[count] = float(tsum[count]) + float(line[f]);
+
+
else:
col.text = '/'
node_line.append(col)
col.set('tree','no')
if tsum[f] != None:
if tsum[f] >= 0.01 :
- total = '%.2f'%(tsum[f])
- txt = str(total or '')
- else :
- txt = str(tsum[f] or '')
+ prec = '%.' + str(tools.config['price_accuracy']) + 'f'
+ total = prec%(tsum[f])
+ txt = str(total or '')
+ col.set('tree','float')
+ else:
+ txt = str(tsum[f] or '')
else:
txt = '/'
if f == 0: