{"action":"closed","issue":{"url":"https://api.github.com/repos/odoo/odoo/issues/6598","labels_url":"https://api.github.com/repos/odoo/odoo/issues/6598/labels{/name}","comments_url":"https://api.github.com/repos/odoo/odoo/issues/6598/comments","events_url":"https://api.github.com/repos/odoo/odoo/issues/6598/events","html_url":"https://github.com/odoo/odoo/issues/6598","id":73873136,"number":6598,"title":"[8.0] Default search only returns 3 results","user":{"login":"Karsten-77","id":11684867,"avatar_url":"https://avatars.githubusercontent.com/u/11684867?v=3","gravatar_id":"","url":"https://api.github.com/users/Karsten-77","html_url":"https://github.com/Karsten-77","followers_url":"https://api.github.com/users/Karsten-77/followers","following_url":"https://api.github.com/users/Karsten-77/following{/other_user}","gists_url":"https://api.github.com/users/Karsten-77/gists{/gist_id}","starred_url":"https://api.github.com/users/Karsten-77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Karsten-77/subscriptions","organizations_url":"https://api.github.com/users/Karsten-77/orgs","repos_url":"https://api.github.com/users/Karsten-77/repos","events_url":"https://api.github.com/users/Karsten-77/events{/privacy}","received_events_url":"https://api.github.com/users/Karsten-77/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-07T07:01:49Z","updated_at":"2015-05-07T08:08:57Z","closed_at":"2015-05-07T08:08:57Z","body":"No idea why, but my search in product.category returns every time only 3 results. Something hardcoded missed?\r\n\r\nIam on 8.0 currently.\r\n\r\nAs example I search for \"baby\" in category Odoo only returns:\r\n   `Deutschland / Baby`\r\n   `Deutschland / Baby / Kinderwagen & -tragen / Babytragen`\r\n   `Deutschland / Baby / Sicherheit / Babyphones`\r\n\r\nwhy not all categories which have Baby in route? When I search for Topcategory \"Baby\" it returns:\r\n\r\n   `Deutschland / Baby / Kleidung, Schuhe & Accessoires`\r\n   `Deutschland / Baby / Pakete & -Sets`\r\n   `Deutschland / Baby / Auto-Kindersitze & Zubehör`\r\n   `Deutschland / Baby / Badezubehör`\r\n   `Deutschland / Baby / Bettausstattung`\r\n   `Deutschland / Baby / Bücher & Zeitschriften`\r\n   `Deutschland / Baby / Ernährung`\r\n   `Deutschland / Baby / Möbel`\r\n   `Deutschland / Baby / Kinderwagen & -tragen`\r\n   `Deutschland / Baby / Pflege`\r\n   `Deutschland / Baby / Sicherheit`\r\n   `Deutschland / Baby / Spielzeug`\r\n   `Deutschland / Baby / Taufe`\r\n   `Deutschland / Baby / Zwillinge`\r\n   `Deutschland / Baby / Sonstige`\r\n\r\nI not found any expression to get ALL categories with Baby in tree. \r\n\r\nAnd as feature request: Why you cannot store the default field in which I want to search?\r\n\r\nOK, sorry that I opened a ticket, it seems caused by the creation of that categories \r\n    `.with_context(defer_parent_store_computation=True)`\r\n\r\nBUT \r\n\r\n    `@api.multi\r\n     def get_site_categories(self, account=None, category=None):\r\n        account = account if account else self\r\n        cat_model = account.env['product.category']\r\n        error_msg = 'Cant get the Site Categories for site %s' % account.site\r\n        if category:\r\n            call_data = dict(LevelLimit=6, DetailLevel='ReturnAll', CategorySiteID=int(account.site.ebay_id), CategoryParent=category)\r\n        else:\r\n            call_data = dict(LevelLimit=2, DetailLevel='ReturnAll', CategorySiteID=int(account.site.ebay_id))\r\n        reply = account.call(account, 'GetCategories', call_data, error_msg).response.reply\r\n        ebay_categories = reply.CategoryArray.Category\r\n        cats = []\r\n        if isinstance(ebay_categories, list):\r\n            for item in ebay_categories:\r\n                cat = dict(CategoryID=item.CategoryID, CategoryLevel=item.CategoryLevel, CategoryName=item.CategoryName,\r\n                           CategoryParentID=item.CategoryParentID)\r\n                cats.append(cat.copy())\r\n        else:\r\n            raise orm.except_orm('Info!', 'This category has no more children')\r\n        cats.sort(key=lambda x: x['CategoryLevel'])\r\n        id_map = {}\r\n        for cat in cats:\r\n            parent_id = ''\r\n            # Checks if this eBay Category exists in database\r\n            record = cat_model.search([('ebay_cat_id', 'in', [cat['CategoryID']])]).id\r\n            if cat['CategoryParentID'] in id_map:\r\n                parent_id = id_map[cat['CategoryParentID']]\r\n            # Checks if it is eBay Root Category\r\n            elif cat['CategoryParentID'] == cat['CategoryID']:\r\n                ebay_cat_id = 'site'+str(account.site.ebay_id)\r\n                root_id = cat_model.search([('ebay_cat_id', 'in', [ebay_cat_id])]).id\r\n                if not root_id:\r\n                    root_id = cat_model.create({'name': account.site.name, 'type': 'ebay',\r\n                                                'ebay_cat_id': ebay_cat_id, 'ebay_site': account.site.ebay_id}).id\r\n                parent_id = root_id\r\n            elif record:\r\n                pass\r\n            else:\r\n                assert False, \"This should not happen if the raw data is consistent\"\r\n            if record:\r\n                id_map[cat['CategoryID']] = record\r\n                continue\r\n            record = cat_model.with_context(defer_parent_store_computation=True).\\\r\n                create({'name': cat['CategoryName'], 'type': 'ebay', 'parent_id': parent_id,\r\n                        'ebay_cat_id': cat['CategoryID'], 'ebay_site': account.site.ebay_id}).id\r\n            print cat['CategoryName'] + '(' + str(record) + ')'\r\n            id_map[cat['CategoryID']] = record\r\n        cat_model._parent_store_compute(cat_model.cr)\r\n        return`\r\n\r\n   `cat_model._parent_store_compute(cat_model.cr)`  my ide returns\r\n{TypeError}_parent_store_compute()takes at least exactly 2 arguments(3 given)\r\n\r\nMh, ok I changed to `cat_model._parent_store_compute()` and it seems to work.\r\nBad documentation of that.\r\n\r\nPerhaps it helps someone other.\r\n\r\n"}}