diff --git a/addons/account/report/account_aged_partner_balance.py b/addons/account/report/account_aged_partner_balance.py index 879560a5b4a..b99070330f7 100644 --- a/addons/account/report/account_aged_partner_balance.py +++ b/addons/account/report/account_aged_partner_balance.py @@ -20,12 +20,10 @@ ############################################################################## import time - -import rml_parse from report import report_sxw from common_report_header import common_report_header -class aged_trial_report(rml_parse.rml_parse, common_report_header): +class aged_trial_report(report_sxw.rml_parse, common_report_header): def __init__(self, cr, uid, name, context): super(aged_trial_report, self).__init__(cr, uid, name, context=context) diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py index 5a6c7700b9d..f9697710f8f 100644 --- a/addons/account/report/account_balance.py +++ b/addons/account/report/account_balance.py @@ -20,7 +20,6 @@ ############################################################################## import time - from report import report_sxw from common_report_header import common_report_header diff --git a/addons/account/report/account_balance.rml b/addons/account/report/account_balance.rml index 9ac1a2f0c87..533999ae5ab 100644 --- a/addons/account/report/account_balance.rml +++ b/addons/account/report/account_balance.rml @@ -148,11 +148,11 @@ - + - + @@ -189,7 +189,7 @@ - + diff --git a/addons/account/report/account_balance_landscape.py b/addons/account/report/account_balance_landscape.py index 6ec7ec7c10e..8576850ff5e 100644 --- a/addons/account/report/account_balance_landscape.py +++ b/addons/account/report/account_balance_landscape.py @@ -22,7 +22,6 @@ import time import locale from report import report_sxw -import rml_parse parents = { 'tr':1, @@ -31,7 +30,7 @@ parents = { 'section': 0 } -class account_balance_landscape(rml_parse.rml_parse): +class account_balance_landscape(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(account_balance_landscape, self).__init__(cr, uid, name, context=context) self.flag=1 diff --git a/addons/account/report/account_balance_sheet.py b/addons/account/report/account_balance_sheet.py index 4d3e06dee05..b6f39fbbebd 100644 --- a/addons/account/report/account_balance_sheet.py +++ b/addons/account/report/account_balance_sheet.py @@ -22,13 +22,12 @@ import time import pooler -import rml_parse from report import report_sxw from account.report import account_profit_loss from common_report_header import common_report_header from tools.translate import _ -class report_balancesheet_horizontal(rml_parse.rml_parse, common_report_header): +class report_balancesheet_horizontal(report_sxw.rml_parse, common_report_header): def __init__(self, cr, uid, name, context=None): super(report_balancesheet_horizontal, self).__init__(cr, uid, name, context=context) self.obj_pl = account_profit_loss.report_pl_account_horizontal(cr, uid, name, context=context) diff --git a/addons/account/report/account_balance_sheet.rml b/addons/account/report/account_balance_sheet.rml index 076de7bdcd4..53dbc453e95 100644 --- a/addons/account/report/account_balance_sheet.rml +++ b/addons/account/report/account_balance_sheet.rml @@ -35,19 +35,7 @@ - - - - - - - - - - - - - + @@ -230,7 +218,7 @@ - + Balance: diff --git a/addons/account/report/account_central_journal.py b/addons/account/report/account_central_journal.py index 6ab5b38d03d..d3113b63133 100644 --- a/addons/account/report/account_central_journal.py +++ b/addons/account/report/account_central_journal.py @@ -20,7 +20,6 @@ ############################################################################## import time - from report import report_sxw from common_report_header import common_report_header # diff --git a/addons/account/report/account_central_journal.rml b/addons/account/report/account_central_journal.rml index 28cb68fcce3..960e2786692 100644 --- a/addons/account/report/account_central_journal.rml +++ b/addons/account/report/account_central_journal.rml @@ -274,7 +274,7 @@ - [[ display_currency(data) == False or removeParentNode('blockTable') ]] + [[ display_currency(data) == False or removeParentNode('blockTable') ]] A/C No. Account Name @@ -283,7 +283,7 @@ Balance - [[ display_currency(data) or removeParentNode('blockTable') ]] + [[ display_currency(data) or removeParentNode('blockTable') ]] A/C No. Account Name @@ -293,7 +293,7 @@ Currency - [[ display_currency(data) == False or removeParentNode('blockTable') ]] + [[ display_currency(data) == False or removeParentNode('blockTable') ]] Total: @@ -302,7 +302,7 @@ [[ formatLang( sum_credit(o.period_id.id, o.journal_id.id)-sum_debit(o.period_id.id, o.journal_id.id) ) ]] [[ company.currency_id.symbol ]] - [[ display_currency(data) or removeParentNode('blockTable') ]] + [[ display_currency(data) or removeParentNode('blockTable') ]] Total: @@ -314,7 +314,7 @@
[[ repeatIn(lines(o.period_id.id,o.journal_id.id),'line') ]] - [[ display_currency(data) == False or removeParentNode('blockTable') ]] + [[ display_currency(data) == False or removeParentNode('blockTable') ]] [[ line['code'] ]] [[ line['name'] ]] @@ -323,7 +323,7 @@ [[ formatLang(line['credit']-line['debit']) ]] [[ company.currency_id.symbol ]] - [[ display_currency(data) or removeParentNode('blockTable') ]] + [[ display_currency(data) or removeParentNode('blockTable') ]] [[ line['code'] ]] [[ line['name'] ]] diff --git a/addons/account/report/account_general_journal.py b/addons/account/report/account_general_journal.py index 4a20ac9ebc4..9eb81157dba 100644 --- a/addons/account/report/account_general_journal.py +++ b/addons/account/report/account_general_journal.py @@ -20,7 +20,6 @@ ############################################################################## import time - from common_report_header import common_report_header from report import report_sxw diff --git a/addons/account/report/account_general_ledger.py b/addons/account/report/account_general_ledger.py index e13604c4219..e1de4d2d522 100644 --- a/addons/account/report/account_general_ledger.py +++ b/addons/account/report/account_general_ledger.py @@ -28,12 +28,10 @@ ############################################################################## import time - from report import report_sxw from common_report_header import common_report_header -import rml_parse -class general_ledger(rml_parse.rml_parse, common_report_header): +class general_ledger(report_sxw.rml_parse, common_report_header): _name = 'report.account.general.ledger' def set_context(self, objects, data, ids, report_type=None): @@ -88,9 +86,20 @@ class general_ledger(rml_parse.rml_parse, common_report_header): 'get_start_date':self._get_start_date, 'get_end_date':self._get_end_date, 'get_target_move': self._get_target_move, + 'strip_name': self._strip_name, }) self.context = context + def _ellipsis(self, orig_str, maxlen=100, ellipsis='...'): + maxlen = maxlen - len(ellipsis) + if maxlen <= 0: + maxlen = 1 + new_str = orig_str[:maxlen] + return new_str + + def _strip_name(self, name, maxlen=50): + return self._ellipsis(name, maxlen, ' ...') + def _sum_currency_amount_account(self, account): self.cr.execute('SELECT sum(l.amount_currency) AS tot_currency \ FROM account_move_line l \ diff --git a/addons/account/report/account_general_ledger.rml b/addons/account/report/account_general_ledger.rml index 479d1b6c65d..0cecffa7384 100644 --- a/addons/account/report/account_general_ledger.rml +++ b/addons/account/report/account_general_ledger.rml @@ -334,7 +334,7 @@ [[ formatLang(line['debit']) ]] [[ formatLang(line['credit']) ]] [[ formatLang(line['progress']) ]] [[ company.currency_id.symbol ]] - [[ line['amount_currency']==True or removeParentNode('font') ]] [[ formatLang(line['amount_currency'])]] [[ line['currency_code'] or '']] + [[ (line.has_key('currency_id') and line['currency_id']==None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'])]] [[ line['currency_code'] or '']]
diff --git a/addons/account/report/account_general_ledger_landscape.rml b/addons/account/report/account_general_ledger_landscape.rml index 41fc999eaad..b965a9c8406 100644 --- a/addons/account/report/account_general_ledger_landscape.rml +++ b/addons/account/report/account_general_ledger_landscape.rml @@ -295,13 +295,13 @@ [[ formatLang(line['debit'], digits=get_digits(dp='Account')) ]] [[ formatLang(line['credit'], digits=get_digits(dp='Account')) ]] [[ formatLang(line['progress'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] - [[ line['amount_currency']==True or removeParentNode('font') ]] [[ formatLang(line['amount_currency'])]] [[ line['currency_code'] or '']] + [[ (line.has_key('currency_id') and line['currency_id']==None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'])]] [[ line['currency_code'] or '']]
- [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]] + [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]] Date JNRL @@ -320,10 +320,10 @@ [[ repeatIn(get_children_accounts(a), 'o') ]] - [[data['form']['amount_currency'] == False or removeParentNode('blockTable')]] + [[data['form']['amount_currency'] == False or removeParentNode('blockTable')]] - + [[ '..'*(o.level-1) ]][[ o.code ]] [[ o.name ]] diff --git a/addons/account/report/account_journal.py b/addons/account/report/account_journal.py index 2a699b20f84..82af01cdb0b 100644 --- a/addons/account/report/account_journal.py +++ b/addons/account/report/account_journal.py @@ -20,7 +20,6 @@ ############################################################################## import time - from common_report_header import common_report_header from report import report_sxw diff --git a/addons/account/report/account_partner_balance.rml b/addons/account/report/account_partner_balance.rml index 19eef489507..780f285a608 100644 --- a/addons/account/report/account_partner_balance.rml +++ b/addons/account/report/account_partner_balance.rml @@ -227,7 +227,7 @@ - + Code (Account/Partner) Name diff --git a/addons/account/report/account_partner_ledger.py b/addons/account/report/account_partner_ledger.py index 52e012e4460..14fd6335375 100644 --- a/addons/account/report/account_partner_ledger.py +++ b/addons/account/report/account_partner_ledger.py @@ -21,12 +21,10 @@ import time import re - -import rml_parse from report import report_sxw from common_report_header import common_report_header -class third_party_ledger(rml_parse.rml_parse, common_report_header): +class third_party_ledger(report_sxw.rml_parse, common_report_header): def __init__(self, cr, uid, name, context=None): super(third_party_ledger, self).__init__(cr, uid, name, context=context) diff --git a/addons/account/report/account_partner_ledger.rml b/addons/account/report/account_partner_ledger.rml index 139d9bb16cd..ffd12e749bb 100644 --- a/addons/account/report/account_partner_ledger.rml +++ b/addons/account/report/account_partner_ledger.rml @@ -277,7 +277,7 @@ - [[ display_currency(data) == False or removeParentNode('blockTable') ]] + [[ display_currency(data) == False or removeParentNode('blockTable') ]] Date @@ -311,20 +311,20 @@ - [[ display_currency(data) == False or removeParentNode('blockTable') ]] + [[ display_currency(data) == False or removeParentNode('blockTable') ]] [[ p.ref ]] - [[ p.name ]] - [[ formatLang((sum_debit_partner(p))) ]] + [[ formatLang((sum_debit_partner(p))) ]] - [[ formatLang((sum_credit_partner(p))) ]] + [[ formatLang((sum_credit_partner(p))) ]] - [[ formatLang((sum_debit_partner(p) - sum_credit_partner(p))) ]] [[ company.currency_id.symbol ]] + [[ formatLang((sum_debit_partner(p) - sum_credit_partner(p))) ]] [[ company.currency_id.symbol ]] @@ -347,7 +347,7 @@
[[ repeatIn(lines(p), 'line') ]] - [[ display_currency(data) == False or removeParentNode('blockTable') ]] + [[ display_currency(data) == False or removeParentNode('blockTable') ]] [[ formatLang(line['date'],date=True) ]] diff --git a/addons/account/report/account_partner_ledger_other.rml b/addons/account/report/account_partner_ledger_other.rml index 644077eec84..1cfbc01ae22 100644 --- a/addons/account/report/account_partner_ledger_other.rml +++ b/addons/account/report/account_partner_ledger_other.rml @@ -432,7 +432,7 @@ - [[ display_currency(data) == False or removeParentNode('blockTable') ]] + [[ display_currency(data) == False or removeParentNode('blockTable') ]] Date @@ -462,7 +462,7 @@
[[ repeatIn(objects, 'p') ]] [[ setLang(p.lang) ]] - [[ display_currency(data) == False or removeParentNode('blockTable') ]] + [[ display_currency(data) == False or removeParentNode('blockTable') ]] @@ -495,7 +495,7 @@
[[ repeatIn(lines(p), 'line') ]] - [[ display_currency(data) == False or removeParentNode('blockTable') ]] + [[ display_currency(data) == False or removeParentNode('blockTable') ]] [[ formatLang(line['date'],date=True) ]] diff --git a/addons/account/report/account_print_invoice.rml b/addons/account/report/account_print_invoice.rml index 87f3bb770ba..c6057627b32 100644 --- a/addons/account/report/account_print_invoice.rml +++ b/addons/account/report/account_print_invoice.rml @@ -194,7 +194,7 @@ - + Description @@ -218,7 +218,7 @@
[[ repeatIn(o.invoice_line,'l') ]] - + [[ l.name ]] @@ -271,7 +271,7 @@
- + @@ -315,7 +315,7 @@ - + Tax [[ o.tax_line==[] and removeParentNode('blockTable') ]] @@ -335,7 +335,7 @@
[[ repeatIn(o.tax_line,'t') ]] - + [[ t.name ]] diff --git a/addons/account/report/account_profit_loss.py b/addons/account/report/account_profit_loss.py index 0bfaea7a570..117f9e351fb 100644 --- a/addons/account/report/account_profit_loss.py +++ b/addons/account/report/account_profit_loss.py @@ -19,14 +19,12 @@ ############################################################################## import time - import pooler -import rml_parse from report import report_sxw from common_report_header import common_report_header from tools.translate import _ -class report_pl_account_horizontal(rml_parse.rml_parse, common_report_header): +class report_pl_account_horizontal(report_sxw.rml_parse, common_report_header): def __init__(self, cr, uid, name, context=None): super(report_pl_account_horizontal, self).__init__(cr, uid, name, context=context) diff --git a/addons/account/report/account_profit_loss.rml b/addons/account/report/account_profit_loss.rml index c371ab4c638..e044c32e139 100644 --- a/addons/account/report/account_profit_loss.rml +++ b/addons/account/report/account_profit_loss.rml @@ -238,7 +238,7 @@ - Total:([[ get_currency(data) ]]) + Total: [[ formatLang(abs(sum_dr())) ]] [[ company.currency_id.symbol ]] diff --git a/addons/account/report/account_tax_code.py b/addons/account/report/account_tax_code.py index 42bbe305381..86d3128cfe7 100644 --- a/addons/account/report/account_tax_code.py +++ b/addons/account/report/account_tax_code.py @@ -21,8 +21,6 @@ ############################################################################## import time - -import rml_parse from report import report_sxw def _get_country(record): @@ -44,7 +42,7 @@ def _record_to_report_line(record): 'country': _get_country(record) } -class account_tax_code_report(rml_parse.rml_parse): +class account_tax_code_report(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(account_tax_code_report, self).__init__(cr, uid, name, context=context) self.localcontext.update({ diff --git a/addons/account/report/account_tax_report.py b/addons/account/report/account_tax_report.py index 9fedbdd94f7..769f0c68c06 100644 --- a/addons/account/report/account_tax_report.py +++ b/addons/account/report/account_tax_report.py @@ -21,11 +21,9 @@ import time - from common_report_header import common_report_header from report import report_sxw - class tax_report(report_sxw.rml_parse, common_report_header): _name = 'report.account.vat.declaration' diff --git a/addons/account/report/account_voucher_print.py b/addons/account/report/account_voucher_print.py index 44587b3e689..7cf9282148d 100644 --- a/addons/account/report/account_voucher_print.py +++ b/addons/account/report/account_voucher_print.py @@ -21,7 +21,6 @@ ############################################################################## import time - from report import report_sxw from tools import amount_to_text_en diff --git a/addons/account/report/rml_parse.py b/addons/account/report/rml_parse.py deleted file mode 100644 index aab5e14c777..00000000000 --- a/addons/account/report/rml_parse.py +++ /dev/null @@ -1,146 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - -import re -import sys - -from report import report_sxw - -class rml_parse(report_sxw.rml_parse): - def __init__(self, cr, uid, name, context): - super(rml_parse, self).__init__(cr, uid, name, context=context) - self.localcontext.update({ - 'comma_me': self.comma_me, - 'format_date': self._get_and_change_date_format_for_swiss, - 'strip_name': self._strip_name, - 'explode_name': self._explode_name, - }) - - def comma_me(self,amount): - #print "#" + str(amount) + "#" - if not amount: - amount = 0.0 - if type(amount) is float: - amount = str('%.2f'%amount) - else: - amount = str(amount) - if (amount == '0'): - return ' ' - orig = amount - new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount) - if orig == new: - return new - else: - return self.comma_me(new) - def _ellipsis(self, string, maxlen=100, ellipsis = '...'): - ellipsis = ellipsis or '' - try: - return string[:maxlen - len(ellipsis) ] + (ellipsis, '')[len(string) < maxlen] - except: - return False - def _strip_name(self, name, maxlen=50): - return self._ellipsis(name, maxlen, '...') - - def _get_and_change_date_format_for_swiss(self,date_to_format): - date_formatted='' - if date_to_format: - date_formatted = strptime(date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y') - return date_formatted - - def _explode_name(self,chaine,length): - # We will test if the size is less then account - full_string = '' - if (len(str(chaine)) <= length): - return chaine - # - else: - chaine = unicode(chaine,'utf8').encode('iso-8859-1') - rup = 0 - for carac in chaine: - rup = rup + 1 - if rup == length: - full_string = full_string + '\n' - full_string = full_string + carac - rup = 0 - else: - full_string = full_string + carac - - return full_string - - def makeAscii(self,str): - try: - Stringer = str.encode("utf-8") - except UnicodeDecodeError: - try: - Stringer = str.encode("utf-16") - except UnicodeDecodeError: - print "UTF_16 Error" - Stringer = str - else: - return Stringer - else: - return Stringer - return Stringer - def explode_this(self,chaine,length): - chaine = rstrip(chaine) - ast = list(chaine) - i = length - while i <= len(ast): - ast.insert(i,'\n') - i = i + length - chaine = str("".join(ast)) - return chaine - def repair_string(self, chaine): - ast = list(chaine) - UnicodeAst = [] - i = 0 - while i < len(ast): - elem = ast[i] - try: - elem.encode("utf-8") - except UnicodeDecodeError: - to_reencode = elem + ast[i+1] - print str(to_reencode) - Good_char = to_reencode.decode('utf-8') - UnicodeAst.append(Good_char) - i += i +2 - else: - UnicodeAst.append(elem) - i += i + 1 - - - return "".join(UnicodeAst) - - def ReencodeAscii(self,str): - print sys.stdin.encoding - try: - Stringer = str.decode("ascii") - except UnicodeEncodeError: - print "REENCODING ERROR" - return str.encode("ascii") - except UnicodeDecodeError: - print "DECODING ERROR" - return str.encode("ascii") - - else: - return Stringer - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file 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 df7c25f3de8..1eac32853e5 100644 --- a/addons/account_invoice_layout/report/report_account_invoice_layout.rml +++ b/addons/account_invoice_layout/report/report_account_invoice_layout.rml @@ -60,7 +60,6 @@ - @@ -245,7 +244,7 @@ - + Description / Taxes @@ -266,7 +265,7 @@
[[ repeatIn(invoice_lines(o), 'a') ]] - + [[ a['type']=='text' and removeParentNode('blockTable')]] @@ -275,10 +274,7 @@ [[ ((a['type']=='title' or a['type']=='subtotal') and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]][[ a['name'] ]] [[ a['type']=='article' and ('/ (' + a['tax_types'] + ')' ) ]] - [[ (a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]][[ a['quantity'] ]] - - - [[ a['uos'] ]] + [[ (a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]][[ a['quantity'] ]] [[ a['uos'] ]] [[ (a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]][[ a['price_unit'] ]] @@ -322,11 +318,6 @@ - - - - - @@ -344,8 +335,8 @@ - [[ a['type']!='break' and removeParentNode('pageBreak')]] - + [[ a['type']!='break' and removeParentNode('pageBreak')]] + Description / Taxes [[ a['type']!='break' and removeParentNode('blockTable')]] @@ -365,7 +356,7 @@
- + @@ -380,7 +371,7 @@ - + @@ -395,7 +386,7 @@ - + @@ -416,7 +407,7 @@ - + Tax [[ o.tax_line==[] and removeParentNode('blockTable') ]] @@ -436,7 +427,7 @@
[[ repeatIn(o.tax_line,'t') ]] - + [[ t.name ]] diff --git a/addons/account_invoice_layout/report/special_message_invoice.rml b/addons/account_invoice_layout/report/special_message_invoice.rml index 2925b3526b8..282dce2d988 100644 --- a/addons/account_invoice_layout/report/special_message_invoice.rml +++ b/addons/account_invoice_layout/report/special_message_invoice.rml @@ -60,7 +60,6 @@ - @@ -249,7 +248,7 @@ - + Description / Taxes @@ -270,7 +269,7 @@
[[ repeatIn(invoice_lines(o), 'a') ]] - + [[ a['type']=='text' and removeParentNode('blockTable')]] @@ -279,10 +278,7 @@ [[ ((a['type']=='title' or a['type']=='subtotal') and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]][[ a['name'] ]] [[ a['type']=='article' and ('/ (' + a['tax_types'] +' )' ) ]] - [[ (a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]][[ a['quantity'] ]] - - - [[ a['uos'] ]] + [[ (a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]][[ a['quantity'] ]] [[ a['uos'] ]] [[ (a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'}))) or removeParentNode('font') ]][[ a['price_unit'] ]] @@ -326,11 +322,6 @@ - - - - - @@ -348,8 +339,8 @@ - [[ a['type']!='break' and removeParentNode('pageBreak')]] - + [[ a['type']!='break' and removeParentNode('pageBreak')]] + Description / Taxes [[ a['type']!='break' and removeParentNode('blockTable')]] @@ -369,7 +360,7 @@
- + @@ -384,7 +375,7 @@ - + @@ -399,7 +390,7 @@ - + @@ -420,7 +411,7 @@ - + Tax [[ o.tax_line==[] and removeParentNode('blockTable') ]] @@ -440,7 +431,7 @@
[[ repeatIn(o.tax_line,'t') ]] - + [[ t.name ]] diff --git a/addons/account_voucher/report/rml_parse.py b/addons/account_voucher/report/rml_parse.py deleted file mode 100644 index 1a5d3fa6ec1..00000000000 --- a/addons/account_voucher/report/rml_parse.py +++ /dev/null @@ -1,150 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - -from report import report_sxw - -from datetime import datetime -import re - -class rml_parse(report_sxw.rml_parse): - def __init__(self, cr, uid, name, context): - super(rml_parse, self).__init__(cr, uid, name, context=None) - self.localcontext.update({ - 'comma_me': self.comma_me, - 'format_date': self._get_and_change_date_format_for_swiss, - 'strip_name': self._strip_name, - 'explode_name': self._explode_name, - }) - - def comma_me(self, amount): - if not amount: - amount = 0.0 - if type(amount) is float: - amount = str('%.2f'%amount) - else: - amount = str(amount) - if (amount == '0'): - return ' ' - orig = amount - new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount) - if orig == new: - return new - else: - return self.comma_me(new) - - def _ellipsis(self, string, maxlen=100, ellipsis = '...'): - ellipsis = ellipsis or '' - try: - return string[:maxlen - len(ellipsis) ] + (ellipsis, '')[len(string) < maxlen] - except: - return False - - def _strip_name(self, name, maxlen=50): - return self._ellipsis(name, maxlen, '...') - - def _get_and_change_date_format_for_swiss (self, date_to_format): - date_formatted = '' - if date_to_format: - date_formatted = datetime.strptime(date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y') - return date_formatted - - def _explode_name(self, chaine, length): - # We will test if the size is less then account - full_string = '' - if (len(str(chaine)) <= length): - return chaine - # - else: - chaine = unicode(chaine,'utf8').encode('iso-8859-1') - rup = 0 - for carac in chaine: - rup = rup + 1 - if rup == length: - full_string = full_string + '\n' - full_string = full_string + carac - rup = 0 - else: - full_string = full_string + carac - - return full_string - - def makeAscii(self, str): - try: - Stringer = str.encode("utf-8") - except UnicodeDecodeError: - try: - Stringer = str.encode("utf-16") - except UnicodeDecodeError: - Stringer = str - else: - return Stringer - else: - return Stringer - return Stringer - - def explode_this(self, chaine, length): - chaine = rstrip(chaine) - ast = list(chaine) - i = length - while i <= len(ast): - ast.insert(i,'\n') - i = i + length - chaine = str("".join(ast)) - return chaine - - def repair_string(self, chaine): - ast = list(chaine) - UnicodeAst = [] - _previouslyfound = False - i = 0 - while i < len(ast): - elem = ast[i] - try: - Stringer = elem.encode("utf-8") - except UnicodeDecodeError: - to_reencode = elem + ast[i+1] - Good_char = to_reencode.decode('utf-8') - UnicodeAst.append(Good_char) - i += i +2 - else: - UnicodeAst.append(elem) - i += i + 1 - return "".join(UnicodeAst) - - def ReencodeAscii(self, str): - try: - Stringer = str.decode("ascii") - except UnicodeEncodeError: - return str.encode("ascii") - except UnicodeDecodeError: - return str.encode("ascii") - else: - return Stringer - - def _add_header(self, node, header=1): - if header == 2: - rml_head = self.rml_header2 - else: - rml_head = self.rml_header - rml_head = rml_head.replace('',''' [[company.logo]] ''') - return True - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/hr_payroll/report/report_employees_detail.py b/addons/hr_payroll/report/report_employees_detail.py index a71fda1492c..76d723c98ea 100644 --- a/addons/hr_payroll/report/report_employees_detail.py +++ b/addons/hr_payroll/report/report_employees_detail.py @@ -28,9 +28,8 @@ import datetime from report import report_sxw import time import pooler -import rml_parse -class employees_salary_report(rml_parse.rml_parse): +class employees_salary_report(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(employees_salary_report, self).__init__(cr, uid, name, context) diff --git a/addons/hr_payroll/report/report_payroll_advice.py b/addons/hr_payroll/report/report_payroll_advice.py index ec79d2a85e1..58484616472 100644 --- a/addons/hr_payroll/report/report_payroll_advice.py +++ b/addons/hr_payroll/report/report_payroll_advice.py @@ -24,7 +24,6 @@ import time from datetime import datetime - from report import report_sxw from tools import amount_to_text_en diff --git a/addons/hr_payroll/report/report_payslip.py b/addons/hr_payroll/report/report_payslip.py index 3d6a4fc550a..bfa6784ac7f 100755 --- a/addons/hr_payroll/report/report_payslip.py +++ b/addons/hr_payroll/report/report_payslip.py @@ -23,7 +23,6 @@ ############################################################################## from datetime import datetime - from report import report_sxw from tools import amount_to_text_en diff --git a/addons/hr_payroll/report/report_year_salary.py b/addons/hr_payroll/report/report_year_salary.py index f084eb2d340..070bb5c8901 100755 --- a/addons/hr_payroll/report/report_year_salary.py +++ b/addons/hr_payroll/report/report_year_salary.py @@ -26,9 +26,8 @@ import datetime from report import report_sxw import time import pooler -import rml_parse -class year_salary_report(rml_parse.rml_parse): +class year_salary_report(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(year_salary_report, self).__init__(cr, uid, name, context) diff --git a/addons/hr_payroll/report/rml_parse.py b/addons/hr_payroll/report/rml_parse.py deleted file mode 100755 index 21fbda2f774..00000000000 --- a/addons/hr_payroll/report/rml_parse.py +++ /dev/null @@ -1,154 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved -# $Id$ -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -############################################################################## -from time import strptime - -from report import report_sxw -import re -from lxml import etree - - -class rml_parse(report_sxw.rml_parse): - def __init__(self, cr, uid, name, context): - super(rml_parse, self).__init__(cr, uid, name, context=None) - self.localcontext.update({ - 'comma_me': self.comma_me, - 'format_date': self._get_and_change_date_format_for_swiss, - 'strip_name' : self._strip_name, - 'explode_name' : self._explode_name, - }) - - def comma_me(self,amount): - if not amount: - amount = 0.0 - if type(amount) is float : - amount = str('%.2f'%amount) - else : - amount = str(amount) - if (amount == '0'): - return ' ' - orig = amount - new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount) - if orig == new: - return new - else: - return self.comma_me(new) - - def _ellipsis(self, string, maxlen=100, ellipsis = '...'): - ellipsis = ellipsis or '' - try: - return string[:maxlen - len(ellipsis) ] + (ellipsis, '')[len(string) < maxlen] - except Exception: - return False - - def _strip_name(self, name, maxlen=50): - return self._ellipsis(name, maxlen, '...') - - def _get_and_change_date_format_for_swiss (self,date_to_format): - date_formatted='' - if date_to_format: - date_formatted = strptime(date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y') - return date_formatted - - def _explode_name(self,chaine,length): - # We will test if the size is less then account - full_string = '' - if (len(str(chaine)) <= length): - return chaine - # - else: - chaine = unicode(chaine,'utf8').encode('iso-8859-1') - rup = 0 - for carac in chaine: - rup = rup + 1 - if rup == length: - full_string = full_string + '\n' - full_string = full_string + carac - rup = 0 - else: - full_string = full_string + carac - - return full_string - - def makeAscii(self,str): - try: - Stringer = str.encode("utf-8") - except UnicodeDecodeError: - try: - Stringer = str.encode("utf-16") - except UnicodeDecodeError: - print "UTF_16 Error" - Stringer = str - else: - return Stringer - else: - return Stringer - return Stringer - - def explode_this(self,chaine,length): - chaine = chaine.rstrip() - ast = list(chaine) - i = length - while i <= len(ast): - ast.insert(i,'\n') - i = i + length - chaine = str("".join(ast)) - return chaine - - def repair_string(self,chaine): - ast = list(chaine) - UnicodeAst = [] - i = 0 - while i < len(ast): - elem = ast[i] - try: - Stringer = elem.encode("utf-8") - except UnicodeDecodeError: - to_reencode = elem + ast[i+1] - print str(to_reencode) - Good_char = to_reencode.decode('utf-8') - UnicodeAst.append(Good_char) - i += i +2 - else: - UnicodeAst.append(elem) - i += i + 1 - return "".join(UnicodeAst) - - def _add_header(self, node, header='external'): - if header=='internal': - rml_head = self.rml_header2 - elif header=='internal landscape': - rml_head = self.rml_header3 - else: - rml_head = self.rml_header - rml_head = rml_head.replace('',''' [[company.logo]] ''') - rml_dom = node - head_dom = etree.XML(rml_head) - for tag in head_dom: - found = rml_dom.find('.//'+tag.tag) - if found is not None and len(found): - if tag.get('position'): - found.append(tag) - else : - found.getparent().replace(found,tag) - return True - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/purchase/report/order.rml b/addons/purchase/report/order.rml index 60ee35b92bb..0ca1a8d6878 100644 --- a/addons/purchase/report/order.rml +++ b/addons/purchase/report/order.rml @@ -226,7 +226,7 @@ - + Description @@ -250,7 +250,7 @@
[[repeatIn(o.order_line,'line')]] - + [[ line.name ]] @@ -265,7 +265,7 @@ [[ formatLang(line.product_qty ) ]] [[ line.product_uom.name ]] - [[ formatLang(line.price_unit, digits=get_digits(dp='Purchase Price') ) ]] + [[ formatLang(line.price_unit, digits=get_digits(dp='Purchase Price') ) ]] [[ formatLang(line.price_subtotal, digits=get_digits(dp='Purchase Price') ) ]] [[ o.pricelist_id.currency_id.symbol ]] @@ -303,7 +303,7 @@
- +