跳至内容
菜单
此问题已终结
3 回复
6264 查看

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
4205
1
10月 22
3905
8
2月 17
8437
0
1月 17
5956
2
2月 24
12685