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 5fabe670f81..b177bc6ede2 100644 --- a/addons/account_invoice_layout/report/report_account_invoice_layout.rml +++ b/addons/account_invoice_layout/report/report_account_invoice_layout.rml @@ -139,42 +139,35 @@ - + -Description -Taxes -Quantity +Description / Taxes +Quantity Unit Price Disc. (%) -Price +Price
[[ repeatIn(invoice_lines(o), 'a') ]] - + [[ a['type']=='text' and removeParentNode('blockTable')]] - [[ (a['type']=='title' or a['type']=='subtotal') and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['name'] ]] - [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['tax_types'] ]] - [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['quantity'] ]] - [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['uos'] ]] + [[ (a['type']=='title' or a['type']=='subtotal') and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['name'] ]] / ( [[ a['tax_types'] ]] ) + [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['quantity'] ]] [[ a['uos'] ]] [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['price_unit'] ]] [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['discount'] ]] - [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['price_subtotal'] ]] - [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['currency'] ]] + [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['price_subtotal'] ]] [[ a['currency'] ]] - [[ format(a['note'] or removeParentNode('tr')) ]] - - + Note : [[ format(a['note'] or removeParentNode('tr')) ]] - @@ -184,18 +177,17 @@ [[ a['type']!='break' and removeParentNode('pageBreak')]] - + - Description [[ a['type']!='break' and removeParentNode('blockTable')]] - Taxes + Description/Taxes [[ a['type']!='break' and removeParentNode('blockTable')]] Quantity Unit Price Disc. (%) - Price + Price
- + @@ -212,14 +204,14 @@ - + Total (Excl. taxes): [[ '%.2f' % o.amount_untaxed ]] [[o.currency_id.code ]] Taxes: - [[ '%.2f' % o.amount_tax ]] [[o.currency_id.code ]] + [[ '%.2f' % o.amount_tax ]] [[o.currency_id.code ]] Total (Incl. taxes): diff --git a/addons/account_invoice_layout/report/special_message_invoice.rml b/addons/account_invoice_layout/report/special_message_invoice.rml index 16deca9e70c..d53d06e9f70 100644 --- a/addons/account_invoice_layout/report/special_message_invoice.rml +++ b/addons/account_invoice_layout/report/special_message_invoice.rml @@ -29,8 +29,10 @@ - - + + + + @@ -139,42 +141,35 @@ Invoice Date: [[ formatLang(o.date_invoice,date=True) ]] Customer Ref: [[ o.address_invoice_id.partner_id.ref or '/' ]] - - - Description - Taxes - Quantity - Unit Price - Disc. (%) - Price - + + +Description / Taxes +Quantity +Unit Price +Disc. (%) +Price +
[[ repeatIn(invoice_lines(o), 'a') ]] - + [[ a['type']=='text' and removeParentNode('blockTable')]] - [[ (a['type']=='title' or a['type']=='subtotal') and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['name'] ]] - [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['tax_types'] ]] - [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['quantity'] ]] - [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['uos'] ]] + [[ (a['type']=='title' or a['type']=='subtotal') and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['name'] ]] / ( [[ a['tax_types'] ]] ) + [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['quantity'] ]] [[ a['uos'] ]] [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['price_unit'] ]] [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['discount'] ]] - [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['price_subtotal'] ]] - [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['currency'] ]] + [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['price_subtotal'] ]] [[ a['currency'] ]] - [[ format(a['note'] or '') ]] - - + Note : [[ format(a['note'] or removeParentNode('tr')) ]] - @@ -184,21 +179,20 @@ [[ a['type']!='break' and removeParentNode('pageBreak')]] - + - Description [[ a['type']!='break' and removeParentNode('blockTable')]] - Taxes + Description/Taxes [[ a['type']!='break' and removeParentNode('blockTable')]] Quantity Unit Price Disc. (%) - Price + Price
- + - + @@ -212,18 +206,18 @@ - + Total (Excl. taxes): [[ '%.2f' % o.amount_untaxed ]] [[o.currency_id.code ]] Taxes: - [[ '%.2f' % o.amount_tax ]] [[o.currency_id.code ]] + [[ '%.2f' % o.amount_tax ]] [[o.currency_id.code ]] Total (Incl. taxes): - [[ '%.2f' % o.amount_total ]] [[o.currency_id.code ]] + [[ '%.2f' % o.amount_total ]] [[o.currency_id.code ]] diff --git a/addons/account_report/report/accounting_report.rml b/addons/account_report/report/accounting_report.rml index c755303870e..95c9f03d1b0 100644 --- a/addons/account_report/report/accounting_report.rml +++ b/addons/account_report/report/accounting_report.rml @@ -65,90 +65,44 @@ -[[ repeatIn(objects,'o') ]] - - - - - - - - -Accounting Report - - - - - - - - - -[[ company.name ]] - - - - - - - -Currency: [[ company.currency_id.name]] - - - - -Printing date: [[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S') ]] - - - -Name - - -Code - - -Amount - - - - - - -
-[[repeatIn(childs(o.id),'obj')]] - - - -[[ '....'*(obj['level']) ]][[ obj['name'] ]] - - -[[obj['code'] ]] - - -[['%.2f' % obj['amount'] ]] - - - - -[[ repeatIn((obj['note'] and obj['note'].splitlines()) or [], 'l') ]] -[[ l or removeParentNode('table') ]] - - - - - - - - - - - - - - - - -
+ [[ repeatIn(objects,'o') ]] + + + + Accounting Report + + + + [[ company.name ]] + + Currency: [[ company.currency_id.name]] + + + Printing date: [[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S') ]] + + + Name + Code + Amount + + + +
+ [[repeatIn(childs(o.id),'obj')]] + + + [[ '....'*(obj['level']) ]][[ obj['name'] ]] + [[obj['code'] ]] + [['%.2f' % obj['amount'] ]] + + + [[ repeatIn((obj['note'] and obj['note'].splitlines()) or [], 'l') ]][[ l or removeParentNode('table') ]] + + + + + +
diff --git a/addons/account_report/report/print_indicator.py b/addons/account_report/report/print_indicator.py index d7bd70f40e4..9d4fa4673f4 100644 --- a/addons/account_report/report/print_indicator.py +++ b/addons/account_report/report/print_indicator.py @@ -73,13 +73,6 @@ import tools import os -parents = { - 'tr':1, - 'li':1, - 'story': 0, - 'section': 0 -} - class accounting_report_indicator(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): @@ -91,6 +84,7 @@ class accounting_report_indicator(report_sxw.rml_parse): 'lines':self.lines, 'getarray':self.getarray, 'gettree':self.gettree, + 'getarray_head':self.getarray_head, }) self.count = 0 self.treecount = 0 @@ -98,61 +92,8 @@ 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 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 = [] - value.extend(self.header_name) - if name=='array': - type = ['float']*len(self.header_name) - else: - type = ['lable'] * (len(self.header_name)) - - width = [438/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) - - if not width: - for v in value: - width.append(30) - for v in range(len(width)): - 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] - i=0 - for v in value: - newnode = lc.cloneNode(1) - if type[i] == 'float': - t1="[[ '%.2f' % " + "%s['%s'] ]]"%(name,v) - if type[i] == 'lable': - t1="%s"%(v) - else: - t1="[[ %s['%s'] ]]"%(name,v) - newnode.childNodes[1].lastChild.data = t1 - child.appendChild(newnode) - newnode=False - i+=1 - return super(accounting_report_indicator,self).repeatIn(lst, name, nodes_parent=False) +# def lines(self,data): res={} @@ -193,12 +134,30 @@ class accounting_report_indicator(report_sxw.rml_parse): result.append(res) return result + def getarray_head(self,data,object,array_header=''): + self.getgraph(data,object,intercall=True) + self.header_val=[str(x) for x in self.header_val] + if data['select_base'] == 'year': + year = [1,2,3,4,5,6,7,8] + temp_head = [str(x) for x in self.header_name] + head_dict = dict(zip(year,temp_head)) + else: + temp_head = [str(x[0:3]) for x in self.header_name] + head_dict = dict(zip(temp_head,temp_head)) + print "head_dict",head_dict + return [head_dict] + def getarray(self,data,object,array_header=''): res={} result=[] self.getgraph(data,object,intercall=True) - self.header_val=[str(x) for x in self.header_val] - temp_dict=zip(self.header_name,self.header_val) + self.header_val = [str(x) for x in self.header_val] + if data['select_base'] == 'year': + year = [1,2,3,4,5,6,7,8] + temp_dict = zip(year,self.header_val) + else: + temp_head = [str(x[0:3]) for x in self.header_name] + temp_dict = zip(temp_head,self.header_val) res=dict(temp_dict) array_header = eval(array_header,{'year':'Fiscal Year','periods':'Periods'}) res[array_header]=object['name'] diff --git a/addons/account_report/report/print_indicator.rml b/addons/account_report/report/print_indicator.rml index 0015324ecbe..f7277115529 100644 --- a/addons/account_report/report/print_indicator.rml +++ b/addons/account_report/report/print_indicator.rml @@ -81,101 +81,93 @@ - + - - Indicators - + Indicators - - + + + + [[ company.name ]] + Currency: [[ company.currency_id.name]] + + + + Printing date: [[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S') ]] + - [[ company.name ]] - - - Currency: [[ company.currency_id.name]] - - + Name - - - - -Printing date: [[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S') ]] - - - -Name - - - - - - - -
-[[ repeatIn(lines(data['form']),'o')]] - - - -[['.....'*(o['level']) ]][[ setTag('font','font',{'color':'white'}) ]]() [[ o['type']=='view' and setTag('para','para',{'fontName':'Helvetica-Bold','fontSize':'10.5'}) ]][[ o['name'] ]] ([[ o['code'] ]]) - - - -[[ o['disp_tree'] and setTag('para','image',{'file':gettree(data['form'],o)}) or removeParentNode('para') ]] -[[ o['disp_graph'] and setTag('para','image',{'width':'450.00','height':'215.00','file':getgraph(data['form'],o)}) or removeParentNode('para') ]] - - - - - -[['..........'*(o['level']) ]][[ setTag('font','font',{'color':'white'}) ]]Expression : [[ o['expression'] ]] - - - - - - - [['..........'*(o['level']) ]][[ setTag('font','font',{'color':'white'}) ]] [[ format(o['note']) or removeParentNode('blockTable') ]] - - - -
- - -Tabular Summary - -
- [[ 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')]] + + + [['.....'*(o['level']) ]][[ o['type']=='view' and setTag('para','para',{'fontName':'Helvetica-Bold','fontSize':'10.5'}) ]]()[[ o['name'] ]] ([[ o['code'] ]]) + + + [[ o['disp_tree'] and setTag('para','image',{'file':gettree(data['form'],o)}) or removeParentNode('para') ]] + [[ o['disp_graph'] and setTag('para','image',{'width':'450.00','height':'215.00','file':getgraph(data['form'],o)}) or removeParentNode('para') ]] + + + + [['..........' *(o['level']) ]]Expression :[[ o['expression'] ]] + + + + + [['..........'*(o['level']) ]] [[ format(o['note']) or removeParentNode('blockTable') ]] + + +
+ + Tabular Summary +
+ [[ repeatIn(getarray_head(data['form'],o,array_header=data['form']['select_base']),'array_header')]] + - - - - - Indicators - + Indicators + [[ array_header['Jan'] or '' ]][[ array_header[1] or '' ]] + [[ array_header['Feb'] or '' ]][[ array_header[2] or '' ]] + [[ array_header['Mar'] or '' ]][[ array_header[3] or '' ]] + [[ array_header['Apr'] or '' ]][[ array_header[4] or '' ]] + [[ array_header['May'] or '' ]][[ array_header[5] or '' ]] + [[ array_header['Jun'] or '' ]][[ array_header[6] or '' ]] + [[ array_header['Jul'] or '' ]][[ array_header[7] or '' ]] + [[ array_header['Aug'] or '' ]][[ array_header[8] or '' ]] + [[ array_header['Sep'] or '' ]] + [[ array_header['Oct'] or '' ]] + [[ array_header['Nov'] or '' ]] + [[ array_header['Dec'] or '' ]] -
-
+
+
[[ repeatIn(lines(data['form']),'obj')]] - [[ repeatIn(getarray(data['form'],obj,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'],obj,array_header=data['form']['select_base']),'array')]] + - - - - - [['.....'*(obj['level']) ]][[ setTag('font','font',{'color':'white'}) ]][[ obj['code'] ]] - + [['.....'*(obj['level']) ]][[ obj['code'] ]] + [[ array['Jan'] or '' ]][[ array[1] or '' ]] + [[ array['Feb'] or '' ]][[ array[2] or '' ]] + [[ array['Mar'] or '' ]][[ array[3] or '' ]] + [[ array['Apr'] or '' ]][[ array[4] or '' ]] + [[ array['May'] or '' ]][[ array[5] or '' ]] + [[ array['Jun'] or '' ]][[ array[6] or '' ]] + [[ array['Jul'] or '' ]][[ array[7] or '' ]] + [[ array['Aug'] or '' ]][[ array[8] or '' ]] + [[ array['Sep'] or '' ]] + [[ array['Oct'] or '' ]] + [[ array['Nov'] or '' ]] + [[ array['Dec'] or '' ]] - - -
- +
+
diff --git a/addons/point_of_sale/report/pos_invoice.py b/addons/point_of_sale/report/pos_invoice.py index 314e627ab6f..6fee06c2e41 100644 --- a/addons/point_of_sale/report/pos_invoice.py +++ b/addons/point_of_sale/report/pos_invoice.py @@ -33,18 +33,14 @@ class pos_invoice(report_sxw.rml_parse): self.localcontext.update({ 'time': time, }) - - def preprocess(self, objects, data, ids): - super(pos_invoice, self).preprocess(objects, data, ids) + + def set_context(self, objects, data, ids, report_type = None): + super(pos_invoice, self).set_context(objects, data, ids, report_type) iids = [] nids = [] - for order in objects: order.write({'nb_print': order.nb_print + 1}) - if order.invoice_id and order.invoice_id not in iids: - if not order.invoice_id: - raise osv.except_osv(_('Error !'), _('Please create an invoice for this sale.')) iids.append(order.invoice_id) nids.append(order.invoice_id.id) self.cr.commit() @@ -55,7 +51,7 @@ class pos_invoice(report_sxw.rml_parse): self.localcontext['data'] = data self.localcontext['objects'] = iids -report_sxw.report_sxw('report.pos.invoice', 'pos.order', 'addons/libeurop/report/invoice.rml', parser= pos_invoice) +report_sxw.report_sxw('report.pos.invoice', 'pos.order', 'account/report/invoice.rml', parser= pos_invoice) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/point_of_sale/report/pos_receipt.rml b/addons/point_of_sale/report/pos_receipt.rml index c0c4ce794a2..641c17e710f 100644 --- a/addons/point_of_sale/report/pos_receipt.rml +++ b/addons/point_of_sale/report/pos_receipt.rml @@ -1,8 +1,8 @@ -