Odoo Help

Welcome!

This community 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.

1

Why does Product search-view not show all products?

By
Kyle Connor
on 2/7/15, 4:03 PM 1,682 views

When entering a line on a Sale Order, I click the Search more button and a Product Search view comes up. This search view shows 80 of 160 products. I have about 1200 products loaded into the system. Whatever the logic is that is pulling these 160 items is also effecting default filters applied to that view.

As an example, I set a filter to show all products that have a cost price of 10$ or more which should pull up 502 items, but it only pulls 120 records. If I then un-apply the filter and re-apply it, thien it shows all 502. So, the logic seems to apply when the window is opened, and not at all afterwards. I don't really know where to look for something that would apply in the background, and then disappear...

0

Axel Mendoza

--Axel Mendoza--
10203
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 3/1/16, 1:07 AM

I solved this using the following js extension:

instance.web.DataSet.include({

name_search: function (name, domain, operator, limit) {

limit = 0;

return this._model.call('name_search', {

name: name || '',

args: domain || false,

operator: operator || 'ilike',

context: this._model.context(),

limit: limit || 0

});

},

});

1
Kyle Connor
On 2/21/15, 8:37 PM

After quite a bit of searching and digging around, I found where this is coded in -

addons/web/static/src/js/view_form.js

values.push({

label: _t("Search More..."),

action: function() {

+ dataset.name_search(search_val, self.build_domain(), 'ilike', 160).done(function(data) {

self._search_create_popup("search", data);

});

---------------------

The point which states '160' is the limit of how many items will be pulled up by the Search More window upon initial query. I modified this to be 161 on a dev system just to test and it worked - the list that was pulled up gave me 161 records.

 

Now I need to figure out how to override this as I would rather not mess with the original code.

Kyle, Great that you found that. Very good to know. Here is a link on how to override/extend js code: https://www.odoo.com/forum/help-1/question/how-can-i-extend-a-js-web-module-64

john5000
on 2/23/15, 9:49 PM
0
Sathors
On 7/28/15, 5:41 PM

You can also refer to this Github issue: https://github.com/odoo/odoo/issues/2235

0
john5000
On 2/7/15, 8:37 PM

Since this is somewhat hard to track down, one way to check this type of problem is to see what the underlying SQL query is doing. That is simple to view and will shed light on what filters are being applied.

You just need to turn on the postgres logging to show all SQL statements that are run, then do your actions, and then check the postgres log file to see what SQL was run. 

Here is how to enable the logging of SQL statements:

  1. Find your "postgresql.conf" file.  (You can find it by doing the following Query in SQL: "show config_file")
  2. Edit that file and set:
    • log_statement=all   -- usual default is set to "none".
    • OR, other way is to set: log_min_duration_statement = 0
  3. You will need to find out where your log file is. Look for "log_destination" in that same postresql.conf file to help find it. I use the GreenOdoo distro and it logs to /var/odoo8/runtime/psql/logfile
  4. Restart postgresql.

After setting that, do the first product search (also, make sure you are the only user). Then look in the log to see what SQL was executed. There will be a lot of excess SQL which you can skip.  Search for "product_product" or "product_template" which are the tables used for products. From there you can see what filters were appled when quering from the table.

 

0

Vasanth

--Vasanth--
3458
| 5 3 8
Pondicherry, India
--Vasanth--
Vasanth
On 2/9/15, 1:33 AM

Hi,

In Openerp,they set the limit has 80 or 120.you can set the limit in the super method as

res = super(product_product,self).name_search(cr, uid, name, args=args, operator=operator, context=context, limit=limit)

Your Answer

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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 2/7/15, 4:03 PM
Seen: 1682 times
Last updated: 5/11/16, 3:33 AM