diff options
| author | Christophe Matthieu <chm@odoo.com> | 2017-03-21 15:30:58 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-04-11 19:44:38 +0200 |
| commit | eaa66d11568b415b8d6b4c7a17a058b5ec1df4a6 (patch) | |
| tree | 822fe86e984e69f989c3574936fe1792ae96fe9b /addons/mail/static/src/js/basic_view.js | |
| parent | e1eea38f2f940fbe252273a5a9d4d03474f81d0a (diff) | |
[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.
Diffstat (limited to 'addons/mail/static/src/js/basic_view.js')
| -rw-r--r-- | addons/mail/static/src/js/basic_view.js | 27 |
1 files changed, 9 insertions, 18 deletions
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); - }, }); }); |
