{"action":"created","issue":{"url":"https://api.github.com/repos/odoo/odoo/issues/4296","labels_url":"https://api.github.com/repos/odoo/odoo/issues/4296/labels{/name}","comments_url":"https://api.github.com/repos/odoo/odoo/issues/4296/comments","events_url":"https://api.github.com/repos/odoo/odoo/issues/4296/events","html_url":"https://github.com/odoo/odoo/pull/4296","id":52252591,"number":4296,"title":"[FIX] expression: apply record rules on search on many2one","user":{"login":"beledouxdenis","id":5822488,"avatar_url":"https://avatars.githubusercontent.com/u/5822488?v=3","gravatar_id":"","url":"https://api.github.com/users/beledouxdenis","html_url":"https://github.com/beledouxdenis","followers_url":"https://api.github.com/users/beledouxdenis/followers","following_url":"https://api.github.com/users/beledouxdenis/following{/other_user}","gists_url":"https://api.github.com/users/beledouxdenis/gists{/gist_id}","starred_url":"https://api.github.com/users/beledouxdenis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beledouxdenis/subscriptions","organizations_url":"https://api.github.com/users/beledouxdenis/orgs","repos_url":"https://api.github.com/users/beledouxdenis/repos","events_url":"https://api.github.com/users/beledouxdenis/events{/privacy}","received_events_url":"https://api.github.com/users/beledouxdenis/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2014-12-17T15:27:59Z","updated_at":"2015-04-28T08:37:24Z","closed_at":"2015-04-28T08:37:24Z","pull_request":{"url":"https://api.github.com/repos/odoo/odoo/pulls/4296","html_url":"https://github.com/odoo/odoo/pull/4296","diff_url":"https://github.com/odoo/odoo/pull/4296.diff","patch_url":"https://github.com/odoo/odoo/pull/4296.patch"},"body":"When performing a search with a one2many field \"is not set\" (such as \"Suppliers\" \"Is not set\" in products), the orm fetches all the records of the relational model for which the relational field is not set, and then apply a 'not in' rule.\r\n\r\nSo, in this example case, when searching \"supplier is not set\" on a product, the orm fetches all \"product.supplierinfo\" records for which product_id is not null, and then apply the 'not in' operator.\r\n\r\nThe thing is, this fetch of all ids is performed with a pure SQL query, for performance concerns, and, therefore, the record rules are not applied. The only way to solve this \"issue\" is to fetch the related records using the orm method \"search\" instead of using SQL, like it is done in this pull request.\r\n\r\nNevertheless, the performance loss concern us, and the search performance on one2many is more important to us than solving this border case. Unless this is proven, with numbers and statistics, that the performances are not too much impacted with this patch, this pull request will probably never be merged in standard Odoo. Nor in 7.0, nor in 8.0."},"comment":{"url":"https://api.github.com/repos/odoo/odoo/issues/comments/96977182","html_url":"https://github.com/odoo/odoo/pull/4296#issuecomment-96977182","issue_url":"https://api.github.com/repos/odoo/odoo/issues/4296","id":96977182,"user":{"login":"beledouxdenis","id":5822488,"avatar_url":"https://avatars.githubusercontent.com/u/5822488?v=3","gravatar_id":"","url":"https://api.github.com/users/beledouxdenis","html_url":"https://github.com/beledouxdenis","followers_url":"https://api.github.com/users/beledouxdenis/followers","following_url":"https://api.github.com/users/beledouxdenis/following{/other_user}","gists_url":"https://api.github.com/users/beledouxdenis/gists{/gist_id}","starred_url":"https://api.github.com/users/beledouxdenis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beledouxdenis/subscriptions","organizations_url":"https://api.github.com/users/beledouxdenis/orgs","repos_url":"https://api.github.com/users/beledouxdenis/repos","events_url":"https://api.github.com/users/beledouxdenis/events{/privacy}","received_events_url":"https://api.github.com/users/beledouxdenis/received_events","type":"User","site_admin":false},"created_at":"2015-04-28T08:37:24Z","updated_at":"2015-04-28T08:37:24Z","body":"Seems no longer needed. Canceling until someone else has the issue."}}