This question has been flagged
1 Reply
5046 Views

Hello everybody!!!

Can anyone explain to me how can i convert AMOUNT to FRENCH LETTERS with DINARS as currency.

In fact, i have tried, this:

from openerp.report import report_sxw

from openerp.tools import amount_to_text_en

from openerp.tools import amount_to_text

import time

import datetime

from datetime import date

from datetime import datetime, date, time

class declaration_cnss(report_sxw.rml_parse):

def __init__(self, cr, uid, name, context):

print ('----------------------test--------------------------')

super(declaration_cnss, self).__init__(cr, uid, name, context)

self.localcontext.update({

'get_employee_lines': self.get_employee_lines,

'amount_to_text': amount_to_text,

'amount_to_text_en': amount_to_text_en

})

And in my function i have this:

amount_in_word = amount_to_text(somme_brut, lang='fr', currency='dinars')

But i got a warning:

2016-01-04 16:02:08,445 14045 WARNING ODOO openerp.tools.amount_to_text_en: no translation function found for lang: 'fr'

And the amount is converted to ENGLISH LETTERS.
Can anyone help please.

Best Regards.

Avatar
Discard
Author Best Answer

Hello everybody!!!

Finally, i have found the answer:

I have to add this: from openerp.tools.amount_to_text import amount_to_text_fr

 

def __init__(self, cr, uid, name, context):

super(declaration_cnss, self).__init__(cr, uid, name, context)

self.localcontext.update({

'get_employee_lines': self.get_employee_lines,

'amount_to_text': amount_to_text,

'amount_to_text_fr': amount_to_text_fr,

})

 And then this:

amount_in_word = amount_to_text_fr(somme_brut, 'Dinars')

Best Regards.
Avatar
Discard