From 3efc458620a26c0fc4192238238e2d8ff39053af Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Mon, 19 Jan 2009 16:00:59 +0530 Subject: [PATCH] Account_report: Correction bzr revid: jvo@tinyerp.com-20090119103059-bmq1vagc91hkhxea --- .../account_report/report/print_indicator.py | 37 ++++++++++--------- .../account_report/report/print_indicator.rml | 26 ++++++++----- .../wizard/wizard_print_indicators.py | 4 +- 3 files changed, 39 insertions(+), 28 deletions(-) diff --git a/addons/account_report/report/print_indicator.py b/addons/account_report/report/print_indicator.py index d7693c8f7ab..e13fe58383f 100644 --- a/addons/account_report/report/print_indicator.py +++ b/addons/account_report/report/print_indicator.py @@ -98,56 +98,59 @@ class accounting_report_indicator(report_sxw.rml_parse): self.header_name = [] self.header_val = [] self.main_dict = {} - + def repeatIn(self, lst, name, nodes_parent=False,td=False,width=[],value=[],type=[],data=''): self._node.data = '' node = self._find_parent(self._node, nodes_parent or parents) ns = node.nextSibling #start - if not name=='array': + if (not name in ['array','array_header']): return super(accounting_report_indicator,self).repeatIn(lst, name, nodes_parent=False) array_header = eval(data,{'year':'Fiscal Year','periods':'Periods'}) value = [array_header] value.extend(self.header_name) - - type=['string'].extend(['float']*len(self.header_name)) - width=[40]*(len(self.header_name)+1) + type=['string'] + if name=='array': + type.extend(['float']*len(self.header_name)) + else: + type=['lable'] * (len(self.header_name)+1) + + width = [538/float(len(value))]*(len(value)) + if not lst: lst.append(1) for ns in node.childNodes : if ns and ns.nodeName!='#text' and ns.tagName=='blockTable' and td : width_str = ns._attrs['colWidths'].nodeValue ns.removeAttribute('colWidths') - total_td = td * len(value) - +# total_td = td * len(value) + if not width: for v in value: width.append(30) - for v in range(len(value)): + for v in range(len(width)): width_str +=',%d'%width[v] - ns.setAttribute('colWidths',width_str) child_list = ns.childNodes - check=0 for child in child_list: if child.nodeName=='tr': lc = child.childNodes[1] -# for t in range(td): i=0 for v in value: newnode = lc.cloneNode(1) - if check==1: - t1="[[ %s['%s'] ]]"%(name,v) - else: + if type[i] == 'float': + t1="[[ '%.2f' % " + "%s['%s'] ]]"%(name,v) + if type[i] == 'lable': t1="%s"%(v) - newnode.childNodes[1].lastChild.data = t1 + else: + t1="[[ %s['%s'] ]]"%(name,v) + newnode.childNodes[1].lastChild.data = t1 child.appendChild(newnode) newnode=False i+=1 - check=1 return super(accounting_report_indicator,self).repeatIn(lst, name, nodes_parent=False) def lines(self,data): @@ -190,7 +193,7 @@ class accounting_report_indicator(report_sxw.rml_parse): temp_dict=zip(self.header_name,self.header_val) res=dict(temp_dict) array_header = eval(array_header,{'year':'Fiscal Year','periods':'Periods'}) - res[array_header]='Value' + res[array_header]=object['name'] result.append(res) return result diff --git a/addons/account_report/report/print_indicator.rml b/addons/account_report/report/print_indicator.rml index 93943ec670c..9a504e68e67 100644 --- a/addons/account_report/report/print_indicator.rml +++ b/addons/account_report/report/print_indicator.rml @@ -150,22 +150,30 @@
- [[ repeatIn(lines(data['form']),'o')]] - [[ o['array_table'] and repeatIn(getarray(data['form'],o,array_header=data['form']['select_base']),'array',td=len(data['form']['base_selection'][0][2]),data=data['form']['select_base']) or removeParentNode('section') ]] + [[ repeatIn(getarray(data['form'],o,array_header=data['form']['select_base']),'array_header',td=len(data['form']['base_selection'][0][2]),data=data['form']['select_base']) or removeParentNode('section') ]] - - - - - - + +
-
+
+ [[ repeatIn(lines(data['form']),'o')]] + [[ repeatIn(getarray(data['form'],o,array_header=data['form']['select_base']),'array',td=len(data['form']['base_selection'][0][2]),data=data['form']['select_base']) or removeParentNode('section') ]] + + + + + + + + + +
+ diff --git a/addons/account_report/wizard/wizard_print_indicators.py b/addons/account_report/wizard/wizard_print_indicators.py index c1cd16f3469..1a7a8d1da74 100644 --- a/addons/account_report/wizard/wizard_print_indicators.py +++ b/addons/account_report/wizard/wizard_print_indicators.py @@ -54,8 +54,8 @@ def _load_base(self, cr, uid, data, context): return data['form'] def _check_len(self, cr, uid, data, context): - if len(data['form']['base_selection'][0][2])>12: - raise wizard.except_wizard('User Error!',"Please select maximum 12 records to fit the page-width.") + if len(data['form']['base_selection'][0][2])>8: + raise wizard.except_wizard('User Error!',"Please select maximum 8 records to fit the page-width.") return data['form'] class wizard_print_indicators(wizard.interface):