Maintainers
This module is maintained by the OCA.
-

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
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 7c95985c..00000000 --- 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.esm.js b/document_page/static/src/js/document_page_kanban_controller.esm.js new file mode 100644 index 00000000..0b7884cb --- /dev/null +++ b/document_page/static/src/js/document_page_kanban_controller.esm.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.esm.js b/document_page/static/src/js/document_page_kanban_view.esm.js new file mode 100644 index 00000000..957bef03 --- /dev/null +++ b/document_page/static/src/js/document_page_kanban_view.esm.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.esm"; + +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 1156d6a6..1d6d8e65 100644 --- a/document_page/views/document_page.xml +++ b/document_page/views/document_page.xml @@ -45,7 +45,12 @@ />