[IMP] report engine: printscreen: total computation now uses digits attribute from field if present
[FIX] report engine: printscreen: fixed wrong indentation bzr revid: olt@tinyerp.com-20101004135530-lj37yioz8kcfk0xd
This commit is contained in:
parent
1711150d96
commit
85bb4e09bc
|
@ -105,13 +105,13 @@ class report_printscreen_list(report_int):
|
||||||
dom = datas.get('_domain',[])
|
dom = datas.get('_domain',[])
|
||||||
get_groupby_data(self.groupby, dom)
|
get_groupby_data(self.groupby, dom)
|
||||||
else:
|
else:
|
||||||
rows = model.read(cr, uid, datas['ids'], result['fields'].keys(), context)
|
rows = model.read(cr, uid, datas['ids'], result['fields'].keys(), context)
|
||||||
ids2 = map(itemgetter('id'), rows) # getting the ids from read result
|
ids2 = map(itemgetter('id'), rows) # getting the ids from read result
|
||||||
if datas['ids'] != ids2: # sorted ids were not taken into consideration for print screen
|
if datas['ids'] != ids2: # sorted ids were not taken into consideration for print screen
|
||||||
rows_new = []
|
rows_new = []
|
||||||
for id in datas['ids']:
|
for id in datas['ids']:
|
||||||
rows_new += [elem for elem in rows if elem['id'] == id]
|
rows_new += [elem for elem in rows if elem['id'] == id]
|
||||||
rows = rows_new
|
rows = rows_new
|
||||||
res = self._create_table(uid, datas['ids'], result['fields'], fields_order, rows, context, model_desc)
|
res = self._create_table(uid, datas['ids'], result['fields'], fields_order, rows, context, model_desc)
|
||||||
return (self.obj.get(), 'pdf')
|
return (self.obj.get(), 'pdf')
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ class report_printscreen_list(report_int):
|
||||||
if line[f] != None:
|
if line[f] != None:
|
||||||
col.text = tools.ustr(line[f] or '')
|
col.text = tools.ustr(line[f] or '')
|
||||||
if float_flag:
|
if float_flag:
|
||||||
col.set('tree','float')
|
col.set('tree','float')
|
||||||
if line.get('__no_leaf') and temp[count] == 1 and f != 'id' and not line['__context']['group_by']:
|
if line.get('__no_leaf') and temp[count] == 1 and f != 'id' and not line['__context']['group_by']:
|
||||||
tsum[count] = float(tsum[count]) + float(line[f])
|
tsum[count] = float(tsum[count]) + float(line[f])
|
||||||
if not line.get('__group') and f != 'id' and temp[count] == 1:
|
if not line.get('__group') and f != 'id' and temp[count] == 1:
|
||||||
|
@ -240,19 +240,18 @@ class report_printscreen_list(report_int):
|
||||||
else:
|
else:
|
||||||
col.text = '/'
|
col.text = '/'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
node_line = etree.SubElement(lines, 'row')
|
node_line = etree.SubElement(lines, 'row')
|
||||||
for f in range(0, len(fields_order)):
|
for f in range(0, len(fields_order)):
|
||||||
col = etree.SubElement(node_line, 'col', para='group', tree='no')
|
col = etree.SubElement(node_line, 'col', para='group', tree='no')
|
||||||
col.set('tree','float')
|
col.set('tree', 'float')
|
||||||
if tsum[f] != None:
|
if tsum[f] != None:
|
||||||
if tsum[f] >= 0.01 :
|
if tsum[f] != 0.0:
|
||||||
prec = '%.2f'
|
digits = fields[fields_order[f]].get('digits', (16, 2))
|
||||||
total = prec%(tsum[f])
|
prec = '%%.%sf' % (digits[1], )
|
||||||
txt = str(total or '')
|
total = prec % (tsum[f], )
|
||||||
else:
|
txt = str(total or '')
|
||||||
txt = str(tsum[f] or '')
|
else:
|
||||||
|
txt = str(tsum[f] or '')
|
||||||
else:
|
else:
|
||||||
txt = '/'
|
txt = '/'
|
||||||
if f == 0:
|
if f == 0:
|
||||||
|
|
Loading…
Reference in New Issue