[FIX] web: fetch toolbar info for target=current actions
The 'Actions' menu displayed in the control panel (aka sidebar, or toolbar), wasn't displayed anymore since the control panel refactoring of4cd379cf6e. Rev.c1752b834correctly made it appear again in list and form views. However, there was another issue as the additional model-related items (like Print, or custom actions) weren't fetched anymore. Thus, the sidebar only contained the default 'Export' and 'Delete' actions. This rev. fixes the second issue. fixes #29546 closes odoo/odoo#29633
This commit is contained in:
@@ -396,7 +396,7 @@ ActionManager.include({
|
||||
var inline = action.target === 'inline';
|
||||
var options = {
|
||||
action_id: action.id,
|
||||
toolbar: inDialog && inline,
|
||||
toolbar: !inDialog && !inline,
|
||||
};
|
||||
var views = action.views.slice();
|
||||
if (!inline && !(inDialog && action.views[0][1] === 'form')) {
|
||||
|
||||
@@ -69,6 +69,9 @@ var ListView = BasicView.extend({
|
||||
params.hasSidebar = !inDialog && !inline;
|
||||
return params;
|
||||
},
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
_updateMVCParams: function () {
|
||||
this._super.apply(this, arguments);
|
||||
this.controllerParams.noLeaf = !!this.loadParams.context.group_by_no_leaf;
|
||||
|
||||
@@ -2127,18 +2127,35 @@ QUnit.module('ActionManager', {
|
||||
});
|
||||
|
||||
QUnit.test('sidebar is present in list view', function (assert) {
|
||||
assert.expect(2);
|
||||
assert.expect(5);
|
||||
|
||||
var actionManager = createActionManager({
|
||||
actions: this.actions,
|
||||
archs: this.archs,
|
||||
data: this.data,
|
||||
mockRPC: function (route, args) {
|
||||
var res = this._super.apply(this, arguments);
|
||||
if (args.method === 'load_views') {
|
||||
assert.strictEqual(args.kwargs.options.toolbar, true,
|
||||
"should ask for toolbar information");
|
||||
return res.then(function (fieldsViews) {
|
||||
fieldsViews.list.toolbar = {
|
||||
print: [{name: "Print that record"}],
|
||||
};
|
||||
return fieldsViews;
|
||||
});
|
||||
}
|
||||
return res;
|
||||
},
|
||||
});
|
||||
actionManager.doAction(3);
|
||||
|
||||
assert.isNotVisible(actionManager.$('.o_cp_sidebar button.o_dropdown_toggler_btn:contains("Print")'));
|
||||
assert.isNotVisible(actionManager.$('.o_cp_sidebar button.o_dropdown_toggler_btn:contains("Action")'));
|
||||
testUtils.dom.clickFirst(actionManager.$('input.custom-control-input'));
|
||||
assert.isVisible(actionManager.$('.o_cp_sidebar button.o_dropdown_toggler_btn:contains("Print")'));
|
||||
assert.isVisible(actionManager.$('.o_cp_sidebar button.o_dropdown_toggler_btn:contains("Action")'));
|
||||
|
||||
actionManager.destroy();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user