跳至內容
選單
此問題已被標幟
2518 瀏覽次數

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?

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
9月 23
1143
1
11月 21
4314
1
10月 20
4456
1
5月 24
4492
3
3月 24
1358