From 3d959382fd92aca6c48ea2413c646edcc1f178f4 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Fri, 31 Mar 2017 14:10:46 +0200 Subject: [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. --- addons/mail/static/src/js/basic_view.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 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 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; -- cgit v1.2.3