Hello,
I am working on a report that contains a table with a 'Total Quantity' cell (A total of all the line quantities). I'd like to show this non-monetary value in 'Words'.
Any help is appreciated, thanks.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello,
I am working on a report that contains a table with a 'Total Quantity' cell (A total of all the line quantities). I'd like to show this non-monetary value in 'Words'.
Any help is appreciated, thanks.
In Py
def conv(self, consultation_fee):
converted_fee=float(consultation_fee)
convert=self.env.user.company_id.currency_id.amount_to_text(converted_fee)
return convert
In XML
<td>
<span> Amount In Words </span> : <span t-esc="doc.conv(doc.consultation_fee)"/>
</td>
Hi,
Try below code
#in .py
from num2words import num2words
#define a function in python to convert
def qty_to_text(self, total):
qty_txt = num2words(total)
return qty_txt
#In .xml
<span t-esc="docs.qty_to_text(docs.total_quantity)"/>
Regards
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
Invoice report to PDF
Solved
|
|
1
Apr 24
|
1347 | |
|
0
Oct 21
|
3811 | ||
|
1
Sep 21
|
4695 | ||
|
0
Mar 17
|
2404 | ||
t-att-href url get error
Solved
|
|
2
Apr 23
|
6951 |