[FIX] account_check_writing: display real currency name on check print

Instead of 'Euro' hardcoded.
As the currency complete name is not available in res.curreny model, exceptions are made for currencies EUR, USD and BRL, the mosts used currencies for checks (+75% of cases)

bzr revid: dle@openerp.com-20131223154631-21oenwn8mxszyo5t
This commit is contained in:
Denis Ledoux 2013-12-23 16:46:31 +01:00
parent 4c0c6bbc76
commit 36846db2c3
2 changed files with 13 additions and 2 deletions

View File

@ -49,9 +49,21 @@ class account_voucher(osv.osv):
if 'value' in default:
amount = 'amount' in default['value'] and default['value']['amount'] or amount
# Currency complete name is not available in res.currency model
# Exceptions done here (EUR, USD, BRL) cover 75% of cases
# For other currencies, display the currency code
currency = self.pool['res.currency'].browse(cr, uid, currency_id, context=context)
if currency.name.upper() == 'EUR':
currency_name = 'Euro'
elif currency.name.upper() == 'USD':
currency_name = 'Dollars'
elif currency.name.upper() == 'BRL':
currency_name = 'reais'
else:
currency_name = currency.name
#TODO : generic amount_to_text is not ready yet, otherwise language (and country) and currency can be passed
#amount_in_word = amount_to_text(amount, context=context)
amount_in_word = amount_to_text(amount)
amount_in_word = amount_to_text(amount, currency=currency_name)
default['value'].update({'amount_in_word':amount_in_word})
if journal_id:
allow_check_writing = self.pool.get('account.journal').browse(cr, uid, journal_id, context=context).allow_check_writing

View File

@ -34,7 +34,6 @@ class report_print_check(report_sxw.rml_parse):
'fill_stars' : self.fill_stars,
})
def fill_stars(self, amount):
amount = amount.replace('Dollars','')
if len(amount) < 100:
stars = 100 - len(amount)
return ' '.join([amount,'*'*stars])