From eaa66d11568b415b8d6b4c7a17a058b5ec1df4a6 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Tue, 21 Mar 2017 15:30:58 +0100 Subject: [REF] web: change internal representation of fields and view meta datas * Data manager load_view returns a viewInfo object * ViewInfo contains: the arch, fields and fieldsInfo objects, and some extra informations * The fields come from the server and are frozen, without any view attributes (depend of the model). * The fieldsInfo contains every view attributes and informations. --- addons/mail/static/src/js/basic_view.js | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'addons/mail/static/src/js/basic_view.js') diff --git a/addons/mail/static/src/js/basic_view.js b/addons/mail/static/src/js/basic_view.js index 624c66c0888..383d5e68f4e 100644 --- a/addons/mail/static/src/js/basic_view.js +++ b/addons/mail/static/src/js/basic_view.js @@ -6,28 +6,19 @@ var BasicView = require('web.BasicView'); var mailWidgets = ['mail_followers', 'mail_thread', 'mail_activity', 'kanban_activity']; BasicView.include({ - init: function () { - this.mailFields = {}; + init: function (viewInfo, params) { this._super.apply(this, arguments); + this.mailFields = {}; + for (var fieldName in viewInfo.fieldsInfo) { + var fieldInfo = viewInfo.fieldsInfo[fieldName]; + if (_.contains(mailWidgets, fieldInfo.widget)) { + this.mailFields[fieldInfo.widget] = fieldName; + fieldInfo.__no_fetch = true; + } + } this.rendererParams.activeActions = this.controllerParams.activeActions; this.rendererParams.mailFields = this.mailFields; }, - - //-------------------------------------------------------------------------- - // Private - //-------------------------------------------------------------------------- - - /** - * @param {Object} field - the field properties - * @param {Object} attrs - the field attributes (from the xml) - */ - _processField: function (field, attrs) { - if (_.contains(mailWidgets, attrs.widget)) { - this.mailFields[attrs.widget] = attrs.name; - field.__no_fetch = true; - } - this._super.apply(this, arguments); - }, }); }); -- cgit v1.2.3