Searching on the basis of searched results

9 views
Skip to first unread message

Khurram Shahzad

unread,
Feb 6, 2018, 5:20:06 AM2/6/18
to try...@googlegroups.com
Hi all,

We have received a pretty strange but sensible requirement regarding searching in Products from our warehouse/procurement department. I will try to explain it using an example.

We have defined a product category being 'Paper for printing' and defined following products in it:

Paper A4
A5
A6 Paper
Legal Size Paper
Paper Executive Size

Now while searching, if they enter 'A5', they should be able to see all products whose name match with 'A5' and also those products whose product category matches with product 'A5' category. Thus they will be able to select from the list of all 5 products mentioned above and they typed anyone of those.


--
 
Regards,
Khurram.

Sergi Almacellas Abellana

unread,
Feb 6, 2018, 5:33:24 AM2/6/18
to try...@googlegroups.com
El 06/02/18 a les 11:11, Khurram Shahzad ha escrit:
You should override the rec_name searcher on the product model to
include also the name from the products of the same category. Haven't
tested but this can be done with a domain like:

[('categories.product.rec_name',) + tuple(clause[1:])]

Hope it helps.


--
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk

Khurram Shahzad

unread,
Feb 6, 2018, 6:05:06 AM2/6/18
to try...@googlegroups.com
Dear Sergi,

Thank you so much for the prompt response. But, is 'categories' filed defined in product? Or it is sort of implicit field available?

Hope it helps.


Regards,
Khurram.

Sergi Almacellas Abellana

unread,
Feb 6, 2018, 6:09:02 AM2/6/18
to try...@googlegroups.com
El 06/02/18 a les 11:51, Khurram Shahzad ha escrit:
The field is defined on template but it's replicated as Function field
on product. This function field is searchable and will pick the values
of the template.

This makes possible (by customization modules) to move attributes from
template to product with not so much effort and make all the existing
code work without changes.
Reply all
Reply to author
Forward
0 new messages