Merge lp:~openerp-dev/openerp-web/7.0-opw-589782-cbi into lp:openerp-web/7.0

Proposed by Chris Biersbach (OpenERP)
Status: Rejected
Rejected by: Xavier (Open ERP)
Proposed branch: lp:~openerp-dev/openerp-web/7.0-opw-589782-cbi
Merge into: lp:openerp-web/7.0
Diff against target: 21 lines (+2/-2)
1 file modified
addons/web/static/src/js/view_form.js (+2/-2)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/7.0-opw-589782-cbi
Reviewer Review Type Date Requested Status
Xavier (Open ERP) (community) Needs Fixing
Csaba TOTH (community) Disapprove
Review via email: mp+153147@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Chris Biersbach (OpenERP) (cbi-openerp) wrote :

The issue: A maximum of 7 entries appear in o2m fields (it should be 8)

The reason: The limit was set to 7, the search was done with limit+1 (8).
The results were then sliced (0 to 7 NOT included) -> 7 results

The fix: I changed the limit o 8, the search to limit and now the slice actually behaves the way we want (8 entries)

Revision history for this message
Csaba TOTH (tsabi) wrote :

I tested this patch, and this eliminitaes the "Search more..." action to show up in the list!

review: Disapprove
Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

`limit + 1` is specifically to get one more record if there is, so `Search More` can be displayed if there are more than `this.limit` records in database. Otherwise can not know if there are more than this.limit records in database without second request.

To get 8 records, should just set limit to 8, not change limit in name_search.

review: Needs Fixing

Unmerged revisions

3840. By Chris Biersbach (OpenERP)

[FIX] web: I corrected the limit in the CompletionFieldMixin to 8 instead of 7 so that actually 8 entries appear (instead of 7). This was caused by an incorrect use of the slice method, which does not include the upper bound.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'addons/web/static/src/js/view_form.js'
--- addons/web/static/src/js/view_form.js 2013-03-13 10:17:56 +0000
+++ addons/web/static/src/js/view_form.js 2013-03-13 14:17:08 +0000
@@ -2841,7 +2841,7 @@
2841 */2841 */
2842instance.web.form.CompletionFieldMixin = {2842instance.web.form.CompletionFieldMixin = {
2843 init: function() {2843 init: function() {
2844 this.limit = 7;2844 this.limit = 8;
2845 this.orderer = new instance.web.DropMisordered();2845 this.orderer = new instance.web.DropMisordered();
2846 },2846 },
2847 /**2847 /**
@@ -2856,7 +2856,7 @@
28562856
2857 return this.orderer.add(dataset.name_search(2857 return this.orderer.add(dataset.name_search(
2858 search_val, new instance.web.CompoundDomain(self.build_domain(), [["id", "not in", blacklist]]),2858 search_val, new instance.web.CompoundDomain(self.build_domain(), [["id", "not in", blacklist]]),
2859 'ilike', this.limit + 1, self.build_context())).then(function(data) {2859 'ilike', this.limit, self.build_context())).then(function(data) {
2860 self.last_search = data;2860 self.last_search = data;
2861 // possible selections for the m2o2861 // possible selections for the m2o
2862 var values = _.map(data, function(x) {2862 var values = _.map(data, function(x) {