Hello
How can i add a line with the amount in text in the invoice please? i have the entreprise cloud edition 12.
Thank you for your help.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello
How can i add a line with the amount in text in the invoice please? i have the entreprise cloud edition 12.
Thank you for your help.
You need to add new computed text field in invoice line. There is default function in currency class that convert amount to text. You nedd to call that function with amount parameter.
self.currency_id.amount_to_text(self.amount)
Hi thank you for your help but can you be more specific on how to do this in odoo Studio
from openerp.tools.amount_to_text_en import amount_to_text
define a computed_field.
amount_to_text = fields.Char(string='Amount In Text', compute='convert')
define compute function.
@api.multi
def convert(self):
"""
:param self:
:return:
"""
for record in self:
currency_id = self.env.user.company_id.currency_id.id
record.amount_to_text = self._amount_to_text(record.amount,currency_id)
def _amount_to_text(amount, currency_id):
# 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.env['res.currency'].browse(currency_id)
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)
return amount_to_text(amount, currency=currency_name)
you can do it In the studio add new field (char)
click on more > Compute > add these line of code
for rec in self:
currency = rec.currency_id.with_context(lang='YOU LANG CODE')
amount_text = str(currency.amount_to_text(rec.amount_total))
rec['x_studio_amount_in_word'] = amount_text
Hello,
get a free module: https://apps.odoo.com/apps/modules/12.0/jt_amount_in_words/
Sorry can't do that as i can't use third party modules in Odoo entreprise cloud
ok no problem, but you can copy code from module and add to your cloud module
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up