Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

How to convert amount to french letters and with dinars as currency in ODOO9?

By
Drees Far
on 1/4/16, 11:14 AM 420 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.

1

Drees Far

--Drees Far--
1130
| 5 2 6
Tunis, Tunisia
--Drees Far--
Drees Far
On 1/5/16, 6:32 AM

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.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 1/4/16, 11:14 AM
Seen: 420 times
Last updated: 1/18/16, 3:23 PM