~unifield-team/unifield-web/web-jfb-utp-760

« back to all changes in this revision

Viewing changes to addons/openerp/static/javascript/m2o.js

  • Committer: jf
  • Date: 2013-10-03 10:05:30 UTC
  • mfrom: (4713.2.1 unifield-web)
  • Revision ID: jfb@tempo-consulting.fr-20131003100530-8k6ne0aw95gl4ut7
Tags: pilot2.6
UF-2128 [IMP] HQ instance specific requirements
UTP-816 [IMP] possibility to select multiple instance to have the whole mission accounting and search per mission
lp:~unifield-team/unifield-web/web-utp-816

Show diffs side-by-side

added added

removed removed

Lines of Context:
110
110
        // clicked outside the box, with some text entered
111
111
        // do as if tabbed out
112
112
        this.lastKey = null;
113
 
        this.get_matched();
 
113
        if (!jQuery(this.field).hasClass('m2o_search')) {
 
114
            this.get_matched();
 
115
        }
114
116
        this.clearResults();
115
117
    }
116
118
};
120
122
        return;
121
123
    }
122
124
    if(!jQuery(this.field).hasClass('readonlyfield')) {
123
 
        this.get_matched();
 
125
        // test added:
 
126
        // on form view: to open only 1 popup when a text is entered and the magnifying glass clicked (the popup is opened by lostFocus).
 
127
        // on search view: lostFocus doesn't open a popup and the m2o can have a value not associated to an id
 
128
        if (!this.text.value  || this.field.value || jQuery(this.field).hasClass('m2o_search')) {
 
129
            this.get_matched();
 
130
        }
124
131
    }
125
132
};
126
133
 
337
344
    }
338
345
 
339
346
    //Tab
340
 
    if((evt.which == 9) && this.text.value && !this.field.value) {
 
347
    //if((evt.which == 9) && this.text.value && !this.field.value) {
 
348
    // check with m2o_search added to disable the popup in search view on tab
 
349
    if((evt.which == 9) && this.text.value && !this.field.value && !jQuery(this.field).hasClass('m2o_search')) {
341
350
        this.get_matched();
342
351
    }
343
352
 
371
380
};
372
381
 
373
382
ManyToOne.prototype.get_matched = function() {
374
 
    if (jQuery(this.field).hasClass('m2o_search') &&
 
383
    /* disabled to open the popup in *search view* when a text is entered and the magnifying glass is clicked */
 
384
    /*if (jQuery(this.field).hasClass('m2o_search') &&
375
385
            this.delayedRequest == null &&
376
386
            this.numResultRows == 0 &&
377
387
            this.text.value != '') {
378
388
        // Allow substring search (press ESC at the combobox)
379
389
        return;
380
 
    }
381
 
 
 
390
    }*/
382
391
    if(openobject.http.AJAX_COUNT > 0) {
383
392
        callLater(0, jQuery.proxy(this, 'get_matched'));
384
393
        return;
423
432
                    var id = jQuery(m2o.field).attr('id');
424
433
                    // If the text on m2o field is related to any existing ID,
425
434
                    // we won't set the text to blank while clicking on search
426
 
                    if (!m2o.field.value) {
 
435
                    // if we are on a search view, don't set to blank
 
436
                    if (!m2o.field.value && !jQuery(m2o.field).hasClass('m2o_search')) {
427
437
                        jQuery(idSelector(id + '_text')).val('');
428
438
                    }
429
439
                    open_search_window(m2o.relation, domain, context, m2o.name, 1, text);