2cadz
(Christophe)
April 16, 2020, 6:44am
1
Hi,
If I do a search on the field ‘rec_name’ of ‘product_template’ (what the import_data method of modelstorage does) it does not return any element while on the field ‘name’ it returns the records. On this object the field ‘rec_name’ cannot be used in a search?
regards.
pokoli
(Sergi Almacellas Abellana)
April 16, 2020, 7:10am
2
It’s strange, I did a test and it get the same results using name and using rec_name:
>>> from proteus import Model, config
>>> config.set_trytond()
>>> Template = Model.get('product.template')
>>> len(Template.find([('rec_name', 'ilike', '%paper%')]))
12
>>> len(Template.find([('name', 'ilike', '%paper%')]))
12
No, normally we implement a meaningull rec_name and it’s searcher for most of the models.
Indeed we improved the template rec_name searcher recently .
2cadz
(Christophe)
April 16, 2020, 12:15pm
3
Really weird.
On my database:
>>> len(Template.find([('rec_name', 'ilike', '%2%')]))
0
>>> len(Template.find([('name', 'ilike', '%2%')]))
14
2cadz
(Christophe)
April 16, 2020, 12:20pm
4
Something to think about: the product models were created by importation. On models created by the interface it works.
ced
(Cédric Krier)
April 16, 2020, 12:37pm
5
Template record name search is implemented to search via the products. So if your template has no product it can not find them.
2cadz
(Christophe)
April 16, 2020, 12:48pm
6
Ok, so it is not possible to import models and then products (aka variants)?
ced
(Cédric Krier)
April 16, 2020, 1:56pm
7
I guess the search methods for Template
and Product
rec_name
must be improved to works in such case.
pokoli
(Sergi Almacellas Abellana)
April 16, 2020, 2:53pm
8
2cadz
(Christophe)
April 22, 2020, 2:31pm
9
@pokoli : thank you so much