7.0: res.partner - name_search applies limit too early
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
Fix Released
|
Low
|
OpenERP Publisher's Warranty Team |
Bug Description
the name_search method of res.partner applies the limit argument twice, and the first one is too soon.
Steps to reproduce the bug:
* connect to runbot
* create and save 8 suppliers called AAA1, AAA2, ... AAA8, with the is_company field checked
* create and save 1 customer called AAA10, with a is_company field checked
* open the creation form of a sale.order, set. In the "partner" field, type 'AA' (without quotes)
Expected result : a list of customers, with AAA10 included
Actual result: the list of customers has 1 single customer, "Best Designers, Ayaan Agarwal"
If you type a 3rd 'A' in the field, then AAA10 is displayed.
The cause of the issue is that the limit parameter (set to 8 by the web client) is used first in the SQL query (SELECT partner.id FROM res_partner partner[...] + limit_str which returns a list of at most 8 ids in this case. Then the list of ids is passed to search, which will further reduce the number of entries, which means that in some extreme cases, if the 1st SELECT query only returns records which don't match the args criteria added to the search call, the suggestion list will be empty.
Related branches
- Olivier Dony (Odoo): Needs Fixing
- Csaba TOTH (community): Needs Resubmitting
- Naresh(OpenERP) (community): Needs Fixing
- Alexandre Fayolle - camptocamp (community): Needs Fixing (code review, no test)
-
Diff: 55 lines (+25/-5)2 files modifiedopenerp/addons/base/res/res_partner.py (+1/-5)
openerp/addons/base/test/base_test.yml (+24/-0)
- Olivier Dony (Odoo): Disapprove
- Alexandre Fayolle - camptocamp (community): Needs Fixing (code review, no test)
- Csaba TOTH (community): Disapprove
- Naresh(OpenERP): Pending requested
-
Diff: 16 lines (+3/-3)1 file modifiedopenerp/addons/base/res/res_partner.py (+3/-3)
- OpenERP Core Team: Pending requested
-
Diff: 97 lines (+40/-15)2 files modifiedopenerp/addons/base/res/res_partner.py (+26/-15)
openerp/addons/base/tests/test_base.py (+14/-0)
tags: | added: maintenance |
Changed in openobject-server: | |
assignee: | nobody → OpenERP Publisher's Warranty Team (openerp-opw) |
Changed in openobject-server: | |
status: | New → Fix Committed |
Changed in openobject-server: | |
milestone: | none → 7.0 |
Here is a yaml test illustrating the issue. Please make sure that the patch for the bug features the fix (and that the tests are green)