콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
7 답글
14154 화면

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

아바타
취소
베스트 답변

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

});

},

});

아바타
취소
작성자 베스트 답변

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

베스트 답변

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.

 

아바타
취소
베스트 답변

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)

아바타
취소
베스트 답변

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

아바타
취소
관련 게시물 답글 화면 활동
1
11월 22
2289
1
10월 22
4479
1
3월 15
5151
1
5월 25
2335
0
11월 24
935