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

A customer wants to be able to search for money values using both . and ,  as decimal separators (because we live in a country where , is official separator but . also is often (unofficially) used).


I started with the following filter:

<field name="offer_amount" string="Sum of Quotation" filter_domain="[('offer_amount', 'ilike', self)]"/>


It works for search values with ., such as 14.7

To make it work also for , I would need to sanitize the search value for this field using something like str.replace(',', '.')


I tried

<field name="offer_amount" string="Sum of Quotation" filter_domain="[('offer_amount', 'ilike', str(self).replace('',,'.'))]"/>

but got an error because filter_domain is parsed inside Javascrypt py.js library which doesn't support replace().

What is the right way to transform search values for specific fields?

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
filter_partner not working แก้ไขแล้ว
1
ก.ย. 23
1238
1
พ.ย. 21
4437
1
ต.ค. 20
4566
1
พ.ค. 24
4642
3
มี.ค. 24
1450