Odoo Help

0

Filter many2one field

By
John Doe
on 9/12/16, 3:28 AM 537 views

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.

Thanh Loyal
on 9/12/16, 10:28 PM

i posted a pictures

John Doe
on 9/14/16, 6:05 AM
0
Divyang Jariwala
On 9/14/16, 12:31 AM

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.

0
John Doe
On 9/14/16, 2:38 AM

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

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 9/12/16, 3:28 AM
Seen: 537 times
Last updated: 9/14/16, 2:38 AM