Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3781 มุมมอง

Hello  all,

I have use this code to convert amount to word in my invoice report in odoo 14 C, and it worked great! but now I wannt to do unit tests for this function "amount_to_text" . If you have any ideas how to do it , please help! 

Thank you.

This my python file including this function:

********************************

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')

**************************************



อวตาร
ละทิ้ง

I think no any issues in your code.

ผู้เขียน

Yes it works fine, but I am asked to perform unit tests for this function.
I followed the documentation on unit tests in Odoo but it still doesn't work for me!

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ม.ค. 24
4547
2
ต.ค. 23
2556
0
มิ.ย. 23
3594
How to round sum of if code แก้ไขแล้ว
1
พ.ค. 22
4507
0
พ.ย. 21
21