From: Naresh Choksy Date: Tue, 12 May 2009 11:23:05 +0000 (+0530) Subject: Bugfix[375034]:account_invoice_layout X-Git-Tag: 5.0.7rc2-server~98^2~37 X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=4ea53181bba0a9e956c7e008e15a7974ed2f2eaf;hp=b66c44f96531e7fe817d583f622f00f5fe6e9760;p=odoo%2Fodoo.git Bugfix[375034]:account_invoice_layout bzr revid: nch@tinyerp.com-20090512112305-an22i0tk5rykn8ux --- diff --git a/addons/account_invoice_layout/report/report_account_invoice_layout.py b/addons/account_invoice_layout/report/report_account_invoice_layout.py index 919ccd9..a577f7d 100644 --- a/addons/account_invoice_layout/report/report_account_invoice_layout.py +++ b/addons/account_invoice_layout/report/report_account_invoice_layout.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved # $Id$ # @@ -23,79 +23,17 @@ import time import pooler from report import report_sxw -parents = { - 'tr':1, - 'li':1, - 'story': 0, - 'section': 0 - } - class account_invoice_1(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(account_invoice_1, self).__init__(cr, uid, name, context) self.localcontext.update({ 'time': time, 'invoice_lines': self.invoice_lines, - 'repeat_In':self.repeat_In, }) self.context = context - - def repeat_In(self, lst, name, nodes_parent=False,td=False,width=[],value=[],type=[]): - self._node.data = '' - node = self._find_parent(self._node, nodes_parent or parents) - ns = node.nextSibling - - value=['tax_types','quantity','uos','price_unit','discount','price_subtotal','currency'] - type=['string','string','string','string','string','string','string'] - width=[62,38,29,67,53,53,27] - td=7 - - tableFlag=0 - - if not lst: - lst.append(1) - for ns in node.childNodes : - if tableFlag==1: - break - if ns and ns.nodeName!='#text' and ns.tagName=='blockTable' and td : - tableFlag=1 - - width_str = ns._attrs['colWidths'].nodeValue - ns.removeAttribute('colWidths') - total_td = td * len(value) - - if not width: - for v in value: - width.append(30) - for v in range(len(value)): - width_str +=',%d'%width[v] - - ns.setAttribute('colWidths',width_str) - - child_list = ns.childNodes - - for child in child_list: - if child.nodeName=='tr': - lc = child.childNodes[1] -# for t in range(td): - i=0 - for v in value: - t2="[[%s['type']=='text' and removeParentNode('tr')]]"%(name) - t1= "[[ %s['%s'] ]]"%(name,v) - t3="[[ %s['type']=='subtotal' and ( setTag('para','para',{'fontName':'Times-bold'})) ]]"%name - newnode = lc.cloneNode(1) - - newnode.childNodes[1].lastChild.data = t1 + t2 +t3 -# newnode.childNodes[1].lastChild.data=[[ a['status']==1 and ( setTag('para','para',{'fontName':'Times-bold'})) ]] - child.appendChild(newnode) - newnode=False - i+=1 - - - return super(account_invoice_1,self).repeatIn(lst, name, nodes_parent=False) + self._node = None def invoice_lines(self,invoice): - result =[] sub_total={} info=[] @@ -107,7 +45,6 @@ class account_invoice_1(report_sxw.rml_parse): for id in range(0,len(ids)): info = self.pool.get('account.invoice.line').browse(self.cr, self.uid,ids[id], self.context.copy()) list_in_seq[info]=info.sequence -# invoice_list +=[info] i=1 j=0 final=sorted(list_in_seq.items(), lambda x, y: cmp(x[1], y[1])) @@ -116,11 +53,9 @@ class account_invoice_1(report_sxw.rml_parse): sum_flag[j]=-1 for entry in invoice_list: res={} - if entry.state=='article': self.cr.execute('select tax_id from account_invoice_line_tax where invoice_line_id=%s', (entry.id,)) tax_ids=self.cr.fetchall() - if tax_ids==[]: res['tax_types']='' else: @@ -187,14 +122,14 @@ class account_invoice_1(report_sxw.rml_parse): res['price_subtotal']='' res['currency']='' elif entry.state=='line': - res['quantity']='____________' + res['quantity']='_______________' res['price_unit']='______________' res['discount']='____________' - res['tax_types']='_________________' + res['tax_types']='____________________' res['uos']='_____' - res['name']='________________________________________' - res['price_subtotal']='_______________________' - res['currency']='_______' + res['name']='_______________________________________________' + res['price_subtotal']='____________' + res['currency']='____' elif entry.state=='break': res['type']=entry.state res['name']=entry.name diff --git a/addons/account_invoice_layout/report/report_account_invoice_layout.rml b/addons/account_invoice_layout/report/report_account_invoice_layout.rml index d22e86b..c771e7d 100644 --- a/addons/account_invoice_layout/report/report_account_invoice_layout.rml +++ b/addons/account_invoice_layout/report/report_account_invoice_layout.rml @@ -130,8 +130,7 @@ -Document -: +Document: [[o.name]] @@ -143,7 +142,7 @@ - + Description @@ -166,64 +165,80 @@
-[[ repeat_In(invoice_lines(o), 'a') ]] - - - -[[ a['type']=='text' and removeParentNode('tr')]] - - -[[ a['type']=='title' and ( setTag('font','font',{'size':'11.5'})) ]][[ (a['type']=='title' or a['type']=='subtotal') and ( setTag('font','font',{'name':'Times-bold'})) ]][[ a['type']=='text' and removeParentNode('font') or a['name'] ]] - - - - - - -[[ a['type']=='text' and a['name'] or removeParentNode('table') ]] - - -[[ a['type']=='text' and '' or removeParentNode('table') ]] - - - - - - -[[ a['note']=='' and removeParentNode('table') ]][[ repeatIn(( a['note'] and a['note'].splitlines()) or [], 'note') ]] - - -[[ note or removeParentNode('table') ]] - - - -[[ a['type']!='break' and removeParentNode('pageBreak')]] - - - -Description [[ a['type']!='break' and removeParentNode('tr')]] - - -Taxes - - -Quantity - - -Unit Price - - -Disc. (%) - - -Price - - - + [[ repeatIn(invoice_lines(o), 'a') ]] + + + + [[ a['type']=='text' and removeParentNode('tr')]] + + + [[ (a['type']=='title' or a['type']=='subtotal') and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ a['name'] ]] + + + [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ a['tax_types'] ]] + + + [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ a['quantity'] ]] + + + [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ a['uos'] ]] + + + [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ a['price_unit'] ]] + + + [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ a['discount'] ]] + + + [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ a['price_subtotal'] ]][[ a['currency'] ]] + + + + + + + [[ a['type']=='text' and a['name'] or removeParentNode('blockTable') ]] + + + [[ a['type']=='text' and '' or removeParentNode('blockTable') ]] + + + + + + + [[ a['note']=='' and removeParentNode('blockTable') ]][[ repeatIn(( a['note'] and a['note'].splitlines()) or [], 'note') ]] + + + [[ note or removeParentNode('blockTable') ]] + + + + [[ a['type']!='break' and removeParentNode('pageBreak')]] + + + + Description [[ a['type']!='break' and removeParentNode('tr')]] + + + Taxes + + + Quantity + + + Unit Price + + + Disc. (%) + + + Price + + +
- - - + @@ -281,16 +296,11 @@ - - - +
[[ format(o.comment) or '' ]] - - - [[ format(o.payment_term and o.payment_term.note) or '' ]]