跳至內容
選單
此問題已被標幟
3 回覆
6340 瀏覽次數

Hi.

I need to filter many2one field dropdown list to show me only current year entries. I can do this by domains in xml. It works good for current year but old entries are shown in the form as unknown now.

How can i solve this?

頭像
捨棄

Can you explain "but old entries are shown in the form as unknown now" a bit more?

If you put a domain (something like ('year', '>=', 2016)) in xml, old entries should not show up in the form.

作者

i posted a pictures

最佳答案

Hi John Doe,

If XML is not giving exact result as you want then,

pass a context from that field and override "name_search" method of that class and return your data based on your requirement.

頭像
捨棄
作者 最佳答案

By this domain: <field name="timebox_id" widget="selection" options="{&quot;no_open&quot;: True}" string="Timeframe" domain="[('id','&gt;',40)]"/> it shows :

without domain:

I'd like to keep old timeframes and filter dropdown list only for this year

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
2
5月 25
4331
1
10月 22
4049
8
2月 17
8568
0
1月 17
6041
2
2月 24
12826