[ADD]Added Upstream Patch for board module

This commit is contained in:
Riddhi Kansara 2018-07-19 16:42:36 +05:30
parent 9662062c1b
commit 68d53a77cb
1 changed files with 19 additions and 0 deletions

View File

@ -131,6 +131,9 @@ FormRenderer.include({
'click .oe_dashboard_link_change_layout': '_onChangeLayout',
'click .oe_dashboard_column .oe_close': '_onCloseAction',
}),
custom_events: _.extend({}, FormRenderer.prototype.custom_events, {
switch_view: '_onSwitchView',
}),
/**
* @override
@ -140,6 +143,7 @@ FormRenderer.include({
this.noContentHelp = params.noContentHelp;
this.actionsDescr = {};
this._boardSubcontrollers = []; // for board: controllers of subviews
this._boardFormViewIDs = {}; // for board: mapping subview controller to form view id
},
/**
* Call `on_attach_callback` for each subview
@ -266,6 +270,11 @@ FormRenderer.include({
hasSelectors: false,
});
return view.getController(self).then(function (controller) {
self._boardFormViewIDs[controller.handle] = _.first(
_.find(action.views, function (descr) {
return descr[1] === 'form';
})
);
self._boardSubcontrollers.push(controller);
return controller.appendTo(params.$node);
});
@ -384,6 +393,16 @@ FormRenderer.include({
$action.find('.oe_content').toggle();
this.trigger_up('save_dashboard');
},
/**
* Let FormController know which form view it should display based on the
* window action of the sub controller that is switching view
*
* @private
* @param {OdooEvent} event
*/
_onSwitchView: function (event) {
event.data.formViewID = this._boardFormViewIDs[event.target.handle];
},
});
});