Tejas Tank (OpenERP) has proposed merging 
lp:~openerp-dev/openerp-web/trunk-polish3-search-m2o-field-tta into 
lp:openerp-web.

Requested reviews:
  Amit (Open ERP) (apa-tiny)

For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-polish3-search-m2o-field-tta/+merge/83000

Hello,

Web Client,

For many2one field their was the problem to search when we click on "search 
more" search view does not effect the search_deafult_FIELDNAME.

Here I have fix it, Its working well and giving result as expected where 
search_default_x as context or not.


Thanks,
Tejas - TTA
-- 
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-polish3-search-m2o-field-tta/+merge/83000
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openerp-web/trunk-polish3-search-m2o-field-tta.
=== modified file 'addons/web/static/src/js/view_form.js'
--- addons/web/static/src/js/view_form.js	2011-11-22 10:26:09 +0000
+++ addons/web/static/src/js/view_form.js	2011-11-22 10:50:37 +0000
@@ -2534,6 +2534,16 @@
     start: function() {
         this._super();
         var self = this;
+        search_defaults = {};
+        if( "__contexts" in this.context.__contexts[0])
+        {
+                _.each(this.context.__contexts[0].__contexts[0], function (value, key) {
+                    var match = /^search_default_(.*)$/.exec(key);
+                    if (match) {
+                        search_defaults[match[1]] = value;
+                    }
+                });
+        }
         this.dataset = new openerp.web.ProxyDataSet(this, this.model,
             this.context);
         this.dataset.create_function = function() {
@@ -2548,18 +2558,18 @@
         this.dataset.parent_view = this.options.parent_view;
         this.dataset.on_default_get.add(this.on_default_get);
         if (this.options.initial_view == "search") {
-            this.setup_search_view();
+            this.setup_search_view(search_defaults);
         } else { // "form"
             this.new_object();
         }
     },
-    setup_search_view: function() {
+    setup_search_view: function(search_defaults) {
         var self = this;
         if (this.searchview) {
             this.searchview.stop();
         }
         this.searchview = new openerp.web.SearchView(this,
-                this.dataset, false, {});
+                this.dataset, false,  search_defaults);
         this.searchview.on_search.add(function(domains, contexts, groupbys) {
             if (self.initial_ids) {
                 self.do_search(domains.concat([[["id", "in", self.initial_ids]], self.domain]),

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to