Skip to Content
मेन्यू
This question has been flagged
2 Replies
4894 Views

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.

Avatar
Discard
Best Answer
 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>&#160;:&#160;<span t-esc="doc.conv(doc.consultation_fee)"/>
 </td>

Avatar
Discard
Best Answer

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

Avatar
Discard
Related Posts Replies Views Activity
1
अप्रैल 24
2218
0
अक्तू॰ 21
5104
1
सित॰ 21
6305
0
मार्च 17
3273
2
अप्रैल 23
8552