Merge lp:~unifield-team/unifield-web/web-utp-816 into lp:unifield-web

Proposed by jftempo
Status: Merged
Merged at revision: 4719
Proposed branch: lp:~unifield-team/unifield-web/web-utp-816
Merge into: lp:unifield-web
Diff against target: 67 lines (+17/-7)
1 file modified
addons/openerp/static/javascript/m2o.js (+17/-7)
To merge this branch: bzr merge lp:~unifield-team/unifield-web/web-utp-816
Reviewer Review Type Date Requested Status
UniField Dev Team Pending
Review via email: mp+188997@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/openerp/static/javascript/m2o.js'
2--- addons/openerp/static/javascript/m2o.js 2013-05-28 15:03:21 +0000
3+++ addons/openerp/static/javascript/m2o.js 2013-10-03 07:15:00 +0000
4@@ -110,7 +110,9 @@
5 // clicked outside the box, with some text entered
6 // do as if tabbed out
7 this.lastKey = null;
8- this.get_matched();
9+ if (!jQuery(this.field).hasClass('m2o_search')) {
10+ this.get_matched();
11+ }
12 this.clearResults();
13 }
14 };
15@@ -120,7 +122,12 @@
16 return;
17 }
18 if(!jQuery(this.field).hasClass('readonlyfield')) {
19- this.get_matched();
20+ // test added:
21+ // on form view: to open only 1 popup when a text is entered and the magnifying glass clicked (the popup is opened by lostFocus).
22+ // on search view: lostFocus doesn't open a popup and the m2o can have a value not associated to an id
23+ if (!this.text.value || this.field.value || jQuery(this.field).hasClass('m2o_search')) {
24+ this.get_matched();
25+ }
26 }
27 };
28
29@@ -337,7 +344,9 @@
30 }
31
32 //Tab
33- if((evt.which == 9) && this.text.value && !this.field.value) {
34+ //if((evt.which == 9) && this.text.value && !this.field.value) {
35+ // check with m2o_search added to disable the popup in search view on tab
36+ if((evt.which == 9) && this.text.value && !this.field.value && !jQuery(this.field).hasClass('m2o_search')) {
37 this.get_matched();
38 }
39
40@@ -371,14 +380,14 @@
41 };
42
43 ManyToOne.prototype.get_matched = function() {
44- if (jQuery(this.field).hasClass('m2o_search') &&
45+ /* disabled to open the popup in *search view* when a text is entered and the magnifying glass is clicked */
46+ /*if (jQuery(this.field).hasClass('m2o_search') &&
47 this.delayedRequest == null &&
48 this.numResultRows == 0 &&
49 this.text.value != '') {
50 // Allow substring search (press ESC at the combobox)
51 return;
52- }
53-
54+ }*/
55 if(openobject.http.AJAX_COUNT > 0) {
56 callLater(0, jQuery.proxy(this, 'get_matched'));
57 return;
58@@ -423,7 +432,8 @@
59 var id = jQuery(m2o.field).attr('id');
60 // If the text on m2o field is related to any existing ID,
61 // we won't set the text to blank while clicking on search
62- if (!m2o.field.value) {
63+ // if we are on a search view, don't set to blank
64+ if (!m2o.field.value && !jQuery(m2o.field).hasClass('m2o_search')) {
65 jQuery(idSelector(id + '_text')).val('');
66 }
67 open_search_window(m2o.relation, domain, context, m2o.name, 1, text);

Subscribers

People subscribed via source and target branches

to all changes: