Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I've overrided the name_search() method to help a client search products by other fields other than the defaults. However I found very weird functionality: While my override name_search() fires fine when, say, adding a product to a sales order (from the form drop down), it simply DOES NOT fire when I search from, say, the upper right hand box when I'm looking at a tree view of the products (the one that you use to access "advanced seach").
Would anyone have any idea why this is the case? If so, how can I use the functionality I have developed in my custom name_search in the regular search above tree view (without have to use advanced search)? The client wants to simply type in the search box, and seach by a field that is not the default.
The search box on the tree view is reigned by the search form view, and not by the name_search method of the class. An example modified search view could have:
<search string="Description of the object"> <field name="name" string="Description" filter_domain="['|',('name','ilike',self),('ref','ilike',self)]"/> <field name="another_property" /> </search>
The above search looks for objects that have either the name or the ref properties matching what's on the search field. The user can also select to look for "another_property" matches.
As a side note, there seems to be a maximum of two fields in the filter_domain section, I guess the functionality is limited to that at this point. Hope it helps!
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 11/1/13, 3:17 PM|
|Seen: 2959 times|
|Last updated: 3/16/15, 8:10 AM|