[MERGE] forward port branch saas-12.1 up to 9bcc0498c0

This commit is contained in:
Christophe Simonis
2019-05-28 12:25:14 +02:00
3 changed files with 51 additions and 5 deletions
@@ -376,8 +376,9 @@ var ListController = BasicController.extend({
* @returns {Deferred}
*/
_update: function () {
this._toggleSidebar();
return this._super.apply(this, arguments);
return this._super.apply(this, arguments)
.then(this._toggleSidebar.bind(this))
.then(this._updateButtons.bind(this, 'readonly'));
},
/**
* This helper simply makes sure that the control panel buttons matches the
@@ -14,6 +14,7 @@ var testUtilsDom = require('web.test_utils_dom');
var widgetRegistry = require('web.widget_registry');
var Widget = require('web.Widget');
var createActionManager = testUtils.createActionManager;
var createView = testUtils.createView;
QUnit.module('Views', {
@@ -840,6 +841,47 @@ QUnit.module('Views', {
list.destroy();
});
QUnit.test('editable list view: check that controlpanel buttons are updating when groupby applied', function (assert) {
assert.expect(4);
this.data.foo.fields.foo = {string: "Foo", type: "char", required:true};
var actionManager = createActionManager({
actions: [{
id: 11,
name: 'Partners Action 11',
res_model: 'foo',
type: 'ir.actions.act_window',
views: [[3, 'list']],
search_view_id: [9, 'search'],
}],
archs: {
'foo,3,list': '<tree editable="top"><field name="display_name"/><field name="foo"/></tree>',
'foo,9,search': '<search>'+
'<filter string="candle" name="itsName" context="{\'group_by\': \'foo\'}"/>' +
'</search>',
},
data: this.data,
});
actionManager.doAction(11);
testUtils.dom.click(actionManager.$('.o_list_button_add'));
assert.isNotVisible(actionManager.$('.o_list_button_add'),
"create button should be invisible");
assert.isVisible(actionManager.$('.o_list_button_save'), "save button should be visible");
testUtils.dom.click(actionManager.$('.o_dropdown_toggler_btn:contains("Group By")'));
testUtils.dom.click(actionManager.$('.o_group_by_menu .o_menu_item a:contains("candle")'));
assert.isVisible(actionManager.$('.o_list_button_add'), "create button should be invisible");
assert.isNotVisible(actionManager.$('.o_list_button_save'),
"save button should be invisible after applying groupby");
actionManager.destroy();
});
QUnit.test('selection changes are triggered correctly', function (assert) {
assert.expect(8);
@@ -7,10 +7,10 @@
odoo.define('website_links.website_links_menu', function (require) {
'use strict';
var sAnimations = require('website.content.snippets.animation');
var Widget = require('web.Widget');
var websiteNavbarData = require('website.navbar');
sAnimations.registry.websiteLinksMenu = sAnimations.Class.extend({
selector: '#o_website_links_share_page',
var WebsiteLinksMenu = Widget.extend({
/**
* @override
@@ -20,4 +20,7 @@ sAnimations.registry.websiteLinksMenu = sAnimations.Class.extend({
return this._super.apply(this, arguments);
},
});
websiteNavbarData.websiteNavbarRegistry.add(WebsiteLinksMenu, '#o_website_links_share_page');
});