[FIX] account, general ledger report: fixed the strip_name function

bzr revid: qdp-launchpad@tinyerp.com-20101122162348-paxq56r4wj6mtjqn
This commit is contained in:
qdp-launchpad@tinyerp.com 2010-11-22 17:23:48 +01:00
parent fea21cc0f7
commit 4c8a58015a
1 changed files with 6 additions and 8 deletions

View File

@ -90,15 +90,13 @@ class general_ledger(report_sxw.rml_parse, common_report_header):
})
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 _ellipsis(self, char, size=100, truncation_str='...'):
if len(char) <= size:
return char
return char[:size-len(truncation_str)] + truncation_str
def _strip_name(self, name, maxlen=50):
return self._ellipsis(name, maxlen, ' ...')
return self._ellipsis(name, maxlen)
def _sum_currency_amount_account(self, account):
self.cr.execute('SELECT sum(l.amount_currency) AS tot_currency \
@ -317,4 +315,4 @@ class general_ledger(report_sxw.rml_parse, common_report_header):
report_sxw.report_sxw('report.account.general.ledger', 'account.account', 'addons/account/report/account_general_ledger.rml', parser=general_ledger, header='internal')
report_sxw.report_sxw('report.account.general.ledger_landscape', 'account.account', 'addons/account/report/account_general_ledger_landscape.rml', parser=general_ledger, header='internal landscape')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: