Merge lp:~openerp-dev/openobject-client-web/m2o-autocomplete into lp:openobject-client-web/trunk

Proposed by Sananaz (Open ERP)
Status: Rejected
Rejected by: Xavier (Open ERP)
Proposed branch: lp:~openerp-dev/openobject-client-web/m2o-autocomplete
Merge into: lp:openobject-client-web/trunk
Diff against target: 52 lines (+25/-4)
1 file modified
addons/openerp/static/javascript/m2o.js (+25/-4)
To merge this branch: bzr merge lp:~openerp-dev/openobject-client-web/m2o-autocomplete
Reviewer Review Type Date Requested Status
Krisztian Eyssen (community) Approve
Xavier (Open ERP) (community) Needs Fixing
Review via email: mp+41575@code.launchpad.net

Description of the change

- Passed context, domain for many2one autocomplete.
- Please refer bug:670899.

To post a comment you must log in.
Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

Please use jquery rather than mochikit apis.

review: Needs Fixing
Revision history for this message
Krisztian Eyssen (eyssen) :
review: Approve

Unmerged revisions

3929. By ksh (Axelor)

[FIX] Fixed m2o autocomplete for domain, context.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'addons/openerp/static/javascript/m2o.js'
--- addons/openerp/static/javascript/m2o.js 2010-10-28 10:05:32 +0000
+++ addons/openerp/static/javascript/m2o.js 2010-11-23 11:26:19 +0000
@@ -69,6 +69,8 @@
69 this.hasFocus = false;69 this.hasFocus = false;
70 this.sugestionBoxMouseOver = false;70 this.sugestionBoxMouseOver = false;
71 this.selectedResult = false;71 this.selectedResult = false;
72 this.eval_domain = null;
73 this.eval_context = null;
7274
73 this.select_img = openobject.dom.get(name + '_select');75 this.select_img = openobject.dom.get(name + '_select');
74 this.open_img = openobject.dom.get(name + '_open');76 this.open_img = openobject.dom.get(name + '_open');
@@ -451,6 +453,8 @@
451 this.selectedResultRow = 0;453 this.selectedResultRow = 0;
452 this.numResultRows = 0;454 this.numResultRows = 0;
453 this.lastSearch = null;455 this.lastSearch = null;
456 this.eval_domain = null;
457 this.eval_context = null;
454};458};
455459
456ManyToOne.prototype.doDelayedRequest = function () {460ManyToOne.prototype.doDelayedRequest = function () {
@@ -468,10 +472,27 @@
468 this.processCount++;472 this.processCount++;
469473
470 this.lastSearch = this.text.value;474 this.lastSearch = this.text.value;
471 loadJSONDoc('/openerp/search/get_matched' + "?" + queryString({475 if (this.numResultRows==0) {
472 text: val,476 var self = this;
473 model: this.relation477 var req = eval_domain_context_request({source: this.name, domain: getNodeAttribute(this.field, 'domain'), context: getNodeAttribute(this.field, 'context')});
474 })).addCallback(this.displayResults);478 req.addCallback(function(obj) {
479 self.eval_domain = obj.domain;
480 self.eval_context = obj.context
481 loadJSONDoc('/openerp/search/get_matched' + "?" + queryString({
482 text: val,
483 model: self.relation,
484 _terp_domain: self.eval_domain,
485 _terp_context: self.eval_context
486 })).addCallback(self.displayResults);
487 });
488 } else {
489 loadJSONDoc('/openerp/search/get_matched' + "?" + queryString({
490 text: val,
491 model: this.relation,
492 _terp_domain: this.eval_domain,
493 _terp_context: this.eval_context
494 })).addCallback(self.displayResults);
495 }
475 return true;496 return true;
476};497};
477498