diff options
| author | Aaron Bohy <aab@odoo.com> | 2017-03-31 14:10:46 +0200 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-04-11 19:44:38 +0200 |
| commit | 3d959382fd92aca6c48ea2413c646edcc1f178f4 (patch) | |
| tree | cd66edd59c9629b08bf314afd9156dbfb8d1bfa8 /addons/mail/static/src/js/basic_view.js | |
| parent | 2d449f8f1ac314452285e0952a9228b1460a0910 (diff) | |
[FIX] web,mail: one2many records: multiple views
A record of the basic model may need to be displayed in different
views (e.g. a o2m record is displayed in the, e.g., Kanban view
inside the main form view, and if clicked, it is also displayed
in the form view opened in a dialog). However, the fields present
in those views may differ.
The previous implementation of fieldsInfo in the record didn't
handle that, as it was a dict whose keys were field names. With
this commit, the fieldsInfo is dict whose keys are view types, and
the values are dicts whose keys are field names (the fields of
the corresponding views, with they attrs in the view).
This allows to create multiple o2m records in a row in a form view.
Diffstat (limited to 'addons/mail/static/src/js/basic_view.js')
| -rw-r--r-- | addons/mail/static/src/js/basic_view.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/addons/mail/static/src/js/basic_view.js b/addons/mail/static/src/js/basic_view.js index 383d5e68f4e..a019709dad4 100644 --- a/addons/mail/static/src/js/basic_view.js +++ b/addons/mail/static/src/js/basic_view.js @@ -6,11 +6,12 @@ var BasicView = require('web.BasicView'); var mailWidgets = ['mail_followers', 'mail_thread', 'mail_activity', 'kanban_activity']; BasicView.include({ - init: function (viewInfo, params) { + init: function (viewInfo) { this._super.apply(this, arguments); this.mailFields = {}; - for (var fieldName in viewInfo.fieldsInfo) { - var fieldInfo = viewInfo.fieldsInfo[fieldName]; + var fieldsInfo = viewInfo.fieldsInfo[this.viewType]; + for (var fieldName in fieldsInfo) { + var fieldInfo = fieldsInfo[fieldName]; if (_.contains(mailWidgets, fieldInfo.widget)) { this.mailFields[fieldInfo.widget] = fieldName; fieldInfo.__no_fetch = true; |
