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

I need to prevent the thousand separator on one field (integer) without changing language settings.

Is there any way to implement such a solution on view (form or tree) side?


อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

I have added widget="text" in the field line on XML file and now thousand separator for the integer field doesn't appear anymore. it works for odoo 16

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

for form view using widget="char" and for tree view using widget="text is ok.
otherwise widget="text" can distort the form view because of covering more than one line, and on the tree view using widget= "char" hided the years on the field.

คำตอบที่ดีที่สุด

Hi,

You can try creating a custom field widget and use it for your field in the xml.

FYI, have a look at this post.

Thanks

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

thank you for your reply Savya,
I have found a shorter way :)

All the best

คำตอบที่ดีที่สุด

Oh you can use the t-options attribute in the view XML definition.

อวตาร
ละทิ้ง

You can refer the following application for creating a new widget, in the following app a new custom signature widget is created.
@<a href="https://hauntthehouse.io">haunt the house</a>

คำตอบที่ดีที่สุด

Yes, you can prevent the thousand separator on a specific field in Odoo without changing the language settings by using the t-options attribute in the view XML definition.

Here's an example of how you can implement it:

name="your_field_name" widget="integer" t-options='{"thousands_sep": ""}'/>

In the above code snippet, replace "your_field_name" with the actual name of your field. By adding the t-options attribute to the field, you can specify additional options for the widget. In this case, we're setting the thousands_sep option to an empty string (""), effectively disabling the thousand separator for that field.

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

thank you so much for your reply
however it doesnt work for tree and form view on odoo 16