[FIX] web: pivot: avoid to toggle invalid measure
Before this commit, click on the divider in the menu 'Measures' of the pivot control panel would cause a crash. The present commit fixes that situation. We also bring another small correction: the menu won't close if one clicks on the measure list but not exactly on a menu item or the divider. closes odoo/odoo#55902 X-original-commit: aad9f3fd7499ef8b660cc25fea840a34d70f75a6 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com> Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
This commit is contained in:
co-authored by
Aaron Bohy
parent
a137f22363
commit
3da3ae1178
@@ -173,7 +173,7 @@ odoo.define('web.PivotController', function (require) {
|
||||
if (ev.target.closest('.o_pivot_measures_list')) {
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
const field = $target.data('field');
|
||||
const field = ev.target.dataset.field;
|
||||
if (field) {
|
||||
this.update({ measure: field });
|
||||
}
|
||||
|
||||
@@ -2333,6 +2333,32 @@ QUnit.module('Views', {
|
||||
pivot.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('Click on the measure list but not on a menu item', async function (assert) {
|
||||
assert.expect(2);
|
||||
|
||||
const pivot = await createView({
|
||||
View: PivotView,
|
||||
model: "partner",
|
||||
data: this.data,
|
||||
arch: `<pivot/>`,
|
||||
});
|
||||
|
||||
// open the "Measures" menu
|
||||
await testUtils.dom.click(pivot.el.querySelector('.o_cp_buttons button'));
|
||||
|
||||
// click on the divider in the "Measures" menu does not crash
|
||||
await testUtils.dom.click(pivot.el.querySelector('.o_pivot_measures_list .dropdown-divider'));
|
||||
// the menu should still be open
|
||||
assert.isVisible(pivot.el.querySelector('.o_pivot_measures_list'));
|
||||
|
||||
// click on the measure list but not on a menu item or the separator
|
||||
await testUtils.dom.click(pivot.el.querySelector('.o_pivot_measures_list'));
|
||||
// the menu should still be open
|
||||
assert.isVisible(pivot.el.querySelector('.o_pivot_measures_list'));
|
||||
|
||||
pivot.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('Navigation list view for a group and back with breadcrumbs', async function (assert) {
|
||||
assert.expect(16);
|
||||
// create an action manager to test the interactions with the search view
|
||||
|
||||
Reference in New Issue
Block a user