Skip to content
Snippets Groups Projects
Commit 7836b996 authored by Thibault Delavallée's avatar Thibault Delavallée
Browse files

[REV] base: revert "Hide Save/Discard on Settings until there are modifications"


Why reverting ?

The fact that the control panel changes width on first edit is confusing to the
user. The whole form shifts down. We want to avoid having elements appearing
and disappearing. The issue that the user does not know if he has to save is
still up to date, and will be addressed in the next saas. We will most likely
use what has been done in this task to only display 'There are unsaved
changes'. Thank you all for your work here!

Original task and revert discussion can be found on task ID 1917637 .

This reverts commit 514d6fb9.

closes odoo/odoo#31622

Signed-off-by: default avatarThibault Delavallee (tde) <tde@openerp.com>
parent c84d1835
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,6 @@ var FormRenderer = require('web.FormRenderer');
var view_registry = require('web.view_registry');
var QWeb = core.qweb;
var _t = core._t;
var BaseSettingRenderer = FormRenderer.extend({
events: _.extend({}, FormRenderer.prototype.events, {
......@@ -33,20 +32,6 @@ var BaseSettingRenderer = FormRenderer.extend({
}
},
/**
* @override
* overridden to show statusbar buttons and a message if there are changes
*/
confirmChange: function () {
var self = this;
return this._super.apply(this, arguments).then(function () {
if (self.$('.o_statusbar_buttons').hasClass('d-none')) {
self.$('.o_statusbar_buttons')
.append($('<span/>', {text: _t("There are unsaved changes"), class: 'text-muted ml-2'}))
.removeClass('d-none');
}
});
},
/**
* @override
*/
......@@ -285,7 +270,6 @@ var BaseSettingRenderer = FormRenderer.extend({
this._initModules();
this._renderLeftPanel();
this._initSearch();
this.$('.o_statusbar_buttons').addClass('d-none');
if (config.device.isMobile) {
this._enableSwipe();
}
......
......@@ -178,41 +178,5 @@ QUnit.module('base_settings_tests', {
form.destroy();
});
QUnit.test('settings view shows statusbar buttons only if there are changes to save', function (assert) {
assert.expect(5);
var form = createView({
View: BaseSettingsView,
model: 'project',
data: this.data,
arch: '<form string="Settings" class="oe_form_configuration o_base_settings">' +
'<header>' +
'<button string="Save" type="object" name="execute" class="oe_highlight" />' +
'<button string="Discard" type="object" name="cancel" special="cancel" />'+
'</header>' +
'<div class="o_setting_container">' +
'<div class="settings_tab"/>' +
'<div class="settings">' +
'<div class="notFound o_hidden">No Record Found</div>' +
'<div class="app_settings_block" string="Base Setting" data-key="base-setting">' +
'<field name="bar"/>Make Changes' +
'</div>' +
'</div>' +
'</div>' +
'</form>',
});
testUtils.mock.intercept(form, "field_changed", function (event) {
assert.ok("field changed");
}, true);
assert.containsNone(form, '.o_field_boolean input:checked', "checkbox should not be checked");
assert.hasClass(form.$('.o_statusbar_buttons'), 'd-none', "statusbar buttons should not be shown");
testUtils.dom.click(form.$("input[type='checkbox']"));
assert.strictEqual(form.$('.o_field_boolean input:checked').length, 1,"checkbox should be checked");
assert.isVisible(form.$('.o_statusbar_buttons'), "statusbar buttons should be shown");
form.destroy();
});
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment