Discussion:
[tryton] Searching on the basis of searched results
Khurram Shahzad
2018-02-06 10:11:57 UTC
Permalink
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.
--
You received this message because you are subscribed to the Google Groups "tryton" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/CAM3N3CxrgLtg9j9u%3DueU7emioVbHjiREusogtpB7aWvkTv5ZSQ%40mail.gmail.com.
Sergi Almacellas Abellana
2018-02-06 10:33:20 UTC
Permalink
Post by Khurram Shahzad
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
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.
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
--
You received this message because you are subscribed to the Google Groups "tryton" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/0b43b95f-9052-4c7c-0354-3199791a1de6%40koolpi.com.
Khurram Shahzad
2018-02-06 10:51:26 UTC
Permalink
Dear Sergi,
Post by Sergi Almacellas Abellana
Post by Khurram Shahzad
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
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.
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
[('categories.product.rec_name',) + tuple(clause[1:])]
Thank you so much for the prompt response. But, is 'categories' filed
defined in product? Or it is sort of implicit field available?
Post by Sergi Almacellas Abellana
Hope it helps.
Regards,
Khurram.
--
You received this message because you are subscribed to the Google Groups "tryton" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/CAM3N3Cyw%2B_G3tJeEQ6TzcmJRrZpMFmYWSggpMoGGRVyogpzWSQ%40mail.gmail.com.
Sergi Almacellas Abellana
2018-02-06 11:08:59 UTC
Permalink
Post by Khurram Shahzad
Dear Sergi,
On Tue, Feb 6, 2018 at 3:33 PM, Sergi Almacellas Abellana
Post by Khurram Shahzad
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
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.
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
[('categories.product.rec_name',) + tuple(clause[1:])]
Thank you so much for the prompt response. But, is 'categories' filed
defined in product? Or it is sort of implicit field available?
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.
--
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk
--
You received this message because you are subscribed to the Google Groups "tryton" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/987e8b86-87f9-7905-2e42-a2e223e080e5%40koolpi.com.
Continue reading on narkive:
Loading...