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

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.


อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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)"/>


อวตาร
ละทิ้ง
ผู้เขียน

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 ตอบกลับ มุมมอง กิจกรรม
1
เม.ย. 25
812
2
มี.ค. 25
909
4
พ.ย. 24
6628
1
มี.ค. 24
1597
3
ก.ย. 23
24282