diff --git a/document_page/__manifest__.py b/document_page/__manifest__.py
index e7a125a72be..57e6ded0e3e 100644
--- a/document_page/__manifest__.py
+++ b/document_page/__manifest__.py
@@ -32,6 +32,8 @@
"assets": {
"web.assets_backend": [
"document_page/static/src/scss/document_page.scss",
+ "document_page/static/src/js/document_page_kanban_controller.js",
+ "document_page/static/src/js/document_page_kanban_view.js",
],
},
}
diff --git a/document_page/static/src/js/document_page_kanban.js b/document_page/static/src/js/document_page_kanban.js
deleted file mode 100644
index 7c95985c2b2..00000000000
--- a/document_page/static/src/js/document_page_kanban.js
+++ /dev/null
@@ -1,26 +0,0 @@
-odoo.define("document_page.update_kanban", function (require) {
- "use strict";
-
- var KanbanRecord = require("web.KanbanRecord");
-
- KanbanRecord.include({
- // --------------------------------------------------------------------------
- // Private
- // --------------------------------------------------------------------------
-
- /**
- * @override
- * @private
- */
- _openRecord: function () {
- if (
- this.modelName === "document.page" &&
- this.$(".o_document_page_kanban_boxes a").length
- ) {
- this.$(".o_document_page_kanban_boxes a").first().click();
- } else {
- this._super.apply(this, arguments);
- }
- },
- });
-});
diff --git a/document_page/static/src/js/document_page_kanban_controller.js b/document_page/static/src/js/document_page_kanban_controller.js
new file mode 100644
index 00000000000..9fc613ee01a
--- /dev/null
+++ b/document_page/static/src/js/document_page_kanban_controller.js
@@ -0,0 +1,19 @@
+/** @odoo-module */
+import {KanbanController} from "@web/views/kanban/kanban_controller";
+
+export class DocumentPageKanbanController extends KanbanController {
+ /**
+ * @param {Object} record
+ */
+ async openRecord(record) {
+ const element = document.querySelector(
+ `.o_kanban_record[data-id="${record.id}"] .o_document_page_kanban_boxes a`
+ );
+
+ if (this.props.resModel === "document.page" && element) {
+ element.click();
+ } else {
+ await super.openRecord(record);
+ }
+ }
+}
diff --git a/document_page/static/src/js/document_page_kanban_view.js b/document_page/static/src/js/document_page_kanban_view.js
new file mode 100644
index 00000000000..eb240416134
--- /dev/null
+++ b/document_page/static/src/js/document_page_kanban_view.js
@@ -0,0 +1,11 @@
+/** @odoo-module */
+import {registry} from "@web/core/registry";
+import {kanbanView} from "@web/views/kanban/kanban_view";
+import {DocumentPageKanbanController} from "./document_page_kanban_controller";
+
+export const documentPageKanbanView = {
+ ...kanbanView,
+ Controller: DocumentPageKanbanController,
+};
+
+registry.category("views").add("document_page_kanban_view", documentPageKanbanView);
diff --git a/document_page/views/document_page.xml b/document_page/views/document_page.xml
index 1156d6a6d8a..eaba6d3c4f9 100644
--- a/document_page/views/document_page.xml
+++ b/document_page/views/document_page.xml
@@ -45,7 +45,7 @@
/>