Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
318 Lượt xem

Hello Odoo experts 👋

  • I have a custom float field (e.g., price or rate)
  • I want it to display values with 3 decimal places, like 0.000
  • There is no Create button on the form — I’m just trying to change how an existing float field is displayed in the UI

Thanks in advance !

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,


You can define the decimal precision while defining the field.

Try with the following code.

exchange_rate = fields.Float(string='Exchange.Rate', digits=(16, 3))

* You can change the precision from the UI.

Change the XML as 

<field name="field_name" digits="[3,3]"/>



Hope it helps

Ảnh đại diện
Huỷ bỏ
Tác giả

Will it work with monetary field type ?

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 6 25
525
1
thg 6 25
492
0
thg 11 24
924
0
thg 10 24
774
2
thg 6 25
1277