[MIG] document_page: migration Browse Wiki Content to 17.0

This commit is contained in:
natuan9
2024-11-05 17:25:08 +07:00
committed by Justine Doutreloux
parent d0df693b95
commit 3482986272
7 changed files with 47 additions and 54 deletions

View File

@@ -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);
}
},
});
});

View File

@@ -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);
}
}
}

View File

@@ -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);