Skip to Content
Menu
This question has been flagged

Hi! 

I inherited an invoice report, and now I want to display the total amount  in  words!

What method should I use and how do to use it in  odoo  v14  c ?

Thanks for your help!

Avatar
Discard
Author

Thank you for sharing this, it's exactly what I needed!

Author

@Niyas Raphy
I have used this code for my invoice report, and it worked:
from odoo import fields, models

class InvoiceOrder(models.Model):
_inherit = 'account.move'

# @api.multi
def _compute_amount_in_word(self):
for rec in self:
rec.num_word = str(rec.currency_id.amount_to_text(rec.amount_total))

num_word = fields.Char(string="Amount In Words:", compute='_compute_amount_in_word')

Now I want to do a unit test for this function, and still don't know how to do it!

Related Posts Replies Views Activity
1
Jan 22
1461
0
Jun 21
1674
3
Feb 24
3251
2
Oct 23
1761
1
Apr 23
2375