Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
6293 Lượt xem

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?

Ảnh đại diện
Huỷ bỏ

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.

Tác giả

i posted a pictures

Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 5 25
4263
1
thg 10 22
3950
8
thg 2 17
8512
0
thg 1 17
6014
2
thg 2 24
12750