summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/chrome/search_view.js
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2018-01-05 13:09:43 +0100
committerAaron Bohy <aab@odoo.com>2018-01-26 19:26:03 +0100
commitcb339842d4d8b19f3870127c00a6868af2e95004 (patch)
tree5a738a06894b0318e4398e737ebadf1157b8c073 /addons/web/static/src/js/chrome/search_view.js
parent12fa4e565a734bd4e0be7cb83ff320f32cb4f33e (diff)
[REF] web,*: move fvg processing from DataManager to Views
*: mail, web_diagram
Diffstat (limited to 'addons/web/static/src/js/chrome/search_view.js')
-rw-r--r--addons/web/static/src/js/chrome/search_view.js24
1 files changed, 23 insertions, 1 deletions
diff --git a/addons/web/static/src/js/chrome/search_view.js b/addons/web/static/src/js/chrome/search_view.js
index 6fbda215814..d1b732477e6 100644
--- a/addons/web/static/src/js/chrome/search_view.js
+++ b/addons/web/static/src/js/chrome/search_view.js
@@ -9,6 +9,7 @@ var FilterMenu = require('web.FilterMenu');
var GroupByMenu = require('web.GroupByMenu');
var pyeval = require('web.pyeval');
var search_inputs = require('web.search_inputs');
+var utils = require('web.utils');
var Widget = require('web.Widget');
var _t = core._t;
@@ -274,7 +275,8 @@ var SearchView = Widget.extend({
this._super.apply(this, arguments);
this.options = options;
this.dataset = dataset;
- this.fields_view = fvg;
+ this.fields_view = this._processFieldsView(_.clone(fvg));
+
this.fields = this.fields_view.fields;
this.query = undefined;
this.title = this.options.action && this.options.action.name;
@@ -603,6 +605,26 @@ var SearchView = Widget.extend({
current_category = filter.category;
});
},
+
+ //--------------------------------------------------------------------------
+ // Private
+ //--------------------------------------------------------------------------
+
+ /**
+ * Processes a fieldsView in place. In particular, parses its arch.
+ *
+ * @todo: this function is also defined in AbstractView ; this code
+ * duplication could be removed once the SearchView will be rewritten.
+ * @private
+ * @param {Object} fv
+ * @param {string} fv.arch
+ * @returns {Object} the processed fieldsView
+ */
+ _processFieldsView: function (fv) {
+ var doc = $.parseXML(fv.arch).documentElement;
+ fv.arch = utils.xml_to_json(doc, true);
+ return fv;
+ },
});
_.extend(SearchView, {