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

I created a custom field in product form. This field named as x_studio_part_number.

Now, i want this custom field searchable when searching for product in order line of purchase and sales model.



I already tried modifying the views in product.template.search and product.product.search. 



But, i have to use the "search more.." to prompt the advance search. 



PS. We are using odoo online and studio. So, please give a suggestion/help the fits only we currently have.

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

Hi,
You can add the newly added field to the _rec_names_search of the product.product model.

See: Rec names Search

Thanks

อวตาร
ละทิ้ง
ผู้เขียน

This needs to have an access in the backend server. We are only using Odoo Online and Studio. Is there a way to do it in technical configuration?

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

For that you need to add "_name_search" method in your custom module in product.template object.

	​@api.model
​def _name_search(self, name, domain=None, operator='ilike', limit=None, order=None): domain = list(domain or []) if name: domain += ['|', ('name', operator, name), ('your_custom_field', operator, name)] return self._search(domain, limit=limit, order=order)


อวตาร
ละทิ้ง
ผู้เขียน

This needs to have an access in the backend server. We are only using Odoo Online and Studio. Is there a way to do it in technical configuration?

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

Have you tried inheriting "name_get" function?


What it does is changing the name of search result.

https://www.cybrosys.com/blog/how-to-use-of-name-get-function-in-odoo

อวตาร
ละทิ้ง
ผู้เขียน

This needs to have an access in the backend server. We are only using Odoo Online and Studio. Is there a way to do it in technical configuration?

I don't think there is a possible way to do that without access in the backend server (maybe I haven't tried it). Because it needs to change the way odoo deliver the data

Related Posts ตอบกลับ มุมมอง กิจกรรม
3
ก.ค. 25
1842
1
มิ.ย. 25
1947
2
พ.ค. 25
1823
1
พ.ค. 25
1087
1
ก.พ. 25
38