Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
4 ตอบกลับ
12915 มุมมอง

Advanced Search shows all the fields, I want to remove some fields

give me your suggestions or procedures

อวตาร
ละทิ้ง

@Rajkumar, Is there any progress with this question? I am facing a similar problem too. If yes, please update your solution

คำตอบที่ดีที่สุด

I implemented this for one of my customers who wanted to show fields in the advanced search of products according to the product category defined in context.

The advanced search widget doesn't show fields with the option selectable = False, as you can see here. Unfortunately I didn't find a way that worked to set that option for the field, and I needed it to be a dynamic option (according to some value in context in my case) anyway, so I did it by inheriting fields_get of the model, call the super method which will return a dict of fields with their options, and then add the option selectable=False to the fields I wanted to hide. For example:

def fields_get(self, cr, uid, fields=None, context=None): fields_to_hide = ['description_sale', 'reference'] # you can set this dynamically res = super(product_product, self).fields_get(cr, uid, fields, context) for field in fields_to_hide: res[field]['selectable'] = False return res

I hope it's clear.

 

NOTE:
This code works only if your OpenERP/Odoo branch revision is later than this revision

- server: xal@openerp.com-20131218111214-543cjhkp6k0steyi
- web: xal@openerp.com-20131218113547-myl7eihvw5vbzkaa

https://bugs.launchpad.net/openobject-server/+bug/1114949

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Suggestion from Leonardo Donelli works well for me in v11 (self, context=None) and res = super(class_name, self).fields_get(self, context) . Thank you!

But, solution:

fields.Char(groups="base.group_system")

hides this item in advanced search for User. It will be still visible for Administrator.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Set field groups to hide it.

fields.Char(groups="base.group_system")

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ม.ค. 23
1505
0
พ.ค. 22
2672
1
ธ.ค. 15
5585
1
ก.ค. 25
464
3
พ.ค. 25
1709