diff --git a/addons/web/static/src/views/kanban/kanban_record.js b/addons/web/static/src/views/kanban/kanban_record.js index dc87c9e1643..0f2188dc862 100644 --- a/addons/web/static/src/views/kanban/kanban_record.js +++ b/addons/web/static/src/views/kanban/kanban_record.js @@ -30,7 +30,7 @@ const { COLORS } = ColorList; const formatters = registry.category("formatters"); // These classes determine whether a click on a record should open it. -export const CANCEL_GLOBAL_CLICK = ["a", ".dropdown", ".oe_kanban_action"].join(","); +export const CANCEL_GLOBAL_CLICK = ["a", ".dropdown", ".oe_kanban_action", "[data-bs-toggle]"].join(","); const ALLOW_GLOBAL_CLICK = [".oe_kanban_global_click", ".oe_kanban_global_click_edit"].join(","); /** diff --git a/addons/web/static/src/views/view_compiler.js b/addons/web/static/src/views/view_compiler.js index 40891a0addb..53ae5d0b96a 100644 --- a/addons/web/static/src/views/view_compiler.js +++ b/addons/web/static/src/views/view_compiler.js @@ -199,8 +199,8 @@ export class ViewCompiler { this.id = 1; /** @type {Compiler[]} */ this.compilers = [ - { selector: "a[type],a[data-type]", fn: this.compileButton }, - { selector: "button", fn: this.compileButton, doNotCopyAttributes: true }, + { selector: "a[type]:not([data-bs-toggle]),a[data-type]:not([data-bs-toggle])", fn: this.compileButton }, + { selector: "button:not([data-bs-toggle])", fn: this.compileButton, doNotCopyAttributes: true }, { selector: "field", fn: this.compileField }, { selector: "widget", fn: this.compileWidget }, ]; diff --git a/addons/web/static/tests/views/kanban/kanban_compiler_tests.js b/addons/web/static/tests/views/kanban/kanban_compiler_tests.js new file mode 100644 index 00000000000..48651307a67 --- /dev/null +++ b/addons/web/static/tests/views/kanban/kanban_compiler_tests.js @@ -0,0 +1,56 @@ +/** @odoo-module **/ +import { KanbanCompiler } from "@web/views/kanban/kanban_compiler"; +import { registry } from "@web/core/registry"; +import { makeFakeLocalizationService } from "@web/../tests/helpers/mock_services"; + +function compileTemplate(arch) { + const parser = new DOMParser(); + const xml = parser.parseFromString(arch, "text/xml"); + const compiler = new KanbanCompiler({ kanban: xml.documentElement }); + return compiler.compile("kanban").outerHTML; +} + +function assertTemplatesEqual(template1, template2) { + if (template1.replace(/\s/g, "") === template2.replace(/\s/g, "")) { + QUnit.assert.ok(true); + } else { + QUnit.assert.strictEqual(template1, template2); + } +} + +QUnit.module("Kanban Compiler", (hooks) => { + hooks.beforeEach(() => { + // compiler generates a piece of template for the translate alert in multilang + registry.category("services").add("localization", makeFakeLocalizationService()); + }); + + QUnit.test("bootstrap dropdowns with kanban_ignore_dropdown class should be left as is", async () => { + const arch = ` + + +
+ + +
+
+
+
`; + const expected = ` + + + +
+ + +
+
+
+
+
`; + assertTemplatesEqual(compileTemplate(arch), expected); + }); +}); diff --git a/addons/web/static/tests/views/kanban_view_tests.js b/addons/web/static/tests/views/kanban/kanban_view_tests.js similarity index 100% rename from addons/web/static/tests/views/kanban_view_tests.js rename to addons/web/static/tests/views/kanban/kanban_view_tests.js