Skip to Content
Menu
This question has been flagged
1 Reply
2796 Views

I have a field of type integer which is the following

amount_response = fields.Integer(string="sum to letters")

How can I make this field where only numbers are going to be written, when the user prints the qweb report, the value stored in this field is printed in letters?

Odoo 14 community

Thanks.

Shalom.


Avatar
Discard
Best Answer

Hi,

To convert an amount to text, try call the 'amount to text' method from a qweb report and pass the field 'amount response' as a parameter. It will return the amount in words

t-esc="o.currency_id.amount_to_text(o.amount_response)"/>


Avatar
Discard
Author

I did what you told me, I only put that line of code, in the end it gives me this error in the qweb:
object has no attribute 'currency_id'

I forgot to add that this is my own development, I am not inheriting anything.

Below code will take company currency by default.

@api.model
def _default_currency(self):
return self.env.user.company_id.currency_id

currency_id = fields.Many2one('res.currency', string='Currency', default=_default_currency,track_visibility='always')

Related Posts Replies Views Activity
4
Nov 24
5239
1
Mar 24
399
3
Sep 23
22662
0
Feb 24
1718
1
Sep 22
10802