I have this code in my xml file which is displaying the amount in figures on the pdf.
t-esc="o.amount"
How can I modify this to convert the amount in figures to words?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
Hi Fadil
use amount_to_text in XML code
Try the following
doc.currency_id.amount_to_text(doc.amount)
Regards
Hello,
Thanks for this solution. Worked for me.
Regards.
Create a Python function to convert the amount to words. You can use existing libraries like num2words for this purpose.
Add the Python function to your Odoo model or create a new module specifically for this purpose.
Call the Python function from your Qweb template and pass the amount as a parameter.
create method on python side:
from num2words import num2words
def amount_to_words(amount):
return num2words(amount, lang='en').title()
Changes in XML code:
t t-set="amount_in_words" t-value="amount_to_words(o.amount)"/>
span t-esc="amount_in_words"/>
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng ký