Help

1

Show amount in words without changing Python files

Avatar
LLJC

I'm trying to get amount_to_text working on a Odoo's Cloud Hosted site, but every solution requires me to change/modify python code. Not sure if this is possible on the cloud hosted site or amount_to_text is available natively on QWeb editor. I just need to print the invoice total in letters.

Example:

Total: $240.00

Result: Two hundred and forty dollars

Avatar
Discard
2 Answers
5
Avatar
Paresh Wagh
Best Answer

You cannot modify server side code on the hosted solution. However, you can add custom computed fields to a model which can be based on python code that is entered through the UI.

For example, if you want the Invoice Total in words, add a computed field called  x_amount_total_in_words to the account.move model like so. You can then use the computed field in QWeb like a normal field.



Python Code:

for record in self:
    record['x_amount_total_in_words'] = record.currency_id.amount_to_text(record.amount_total)

Avatar
Discard
0
Avatar
LLJC
Best Answer

@Paresh It works fantastically, thank you very much. I can't upvote or mark as answer (lack of karma). But will return in the future to upvote and mark as answer. Thanks!!

Avatar
Discard