diff --git a/document_page/README.rst b/document_page/README.rst index 10cc4500140..dfad62719ae 100644 --- a/document_page/README.rst +++ b/document_page/README.rst @@ -51,11 +51,11 @@ Usage To use this module, you need to: -- Go to Knowledge menu -- Click on Categories to create the document's category you need with - the template -- Click on Pages to create pages and select the previous category to - use the template +- Go to Knowledge menu +- Click on Categories to create the document's category you need with + the template +- Click on Pages to create pages and select the previous category to use + the template Bug Tracker =========== @@ -78,32 +78,32 @@ Authors Contributors ------------ -- Gervais Naoussi -- Maxime Chambreuil -- Iván Todorovich -- Jose Maria Alzaga -- Lois Rilo -- Simone Orsi -- `Tecnativa `__: +- Gervais Naoussi +- Maxime Chambreuil +- Iván Todorovich +- Jose Maria Alzaga +- Lois Rilo +- Simone Orsi +- `Tecnativa `__: - - Ernesto Tejeda - - Víctor Martínez + - Ernesto Tejeda + - Víctor Martínez Trobz -- Dung Tran -- `Sygel `__: +- Dung Tran +- `Sygel `__: - - Ángel García de la Chica Herrera + - Ángel García de la Chica Herrera Other credits ------------- The development of this module has been financially supported by: -- Odoo SA -- Savoir-faire Linux -- Camptocamp +- Odoo SA +- Savoir-faire Linux +- Camptocamp Maintainers ----------- diff --git a/document_page/__manifest__.py b/document_page/__manifest__.py index e7a125a72be..f5d57e3bc26 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.esm.js", + "document_page/static/src/js/document_page_kanban_view.esm.js", ], }, } diff --git a/document_page/models/document_page.py b/document_page/models/document_page.py index a6a66c58349..459cf458e47 100644 --- a/document_page/models/document_page.py +++ b/document_page/models/document_page.py @@ -94,7 +94,7 @@ class DocumentPage(models.Model): compute="_compute_backend_url", ) - image = fields.Binary("Image", attachment=True) + image = fields.Binary(attachment=True) color = fields.Integer(string="Color Index") @api.depends("menu_id", "parent_id.menu_id") diff --git a/document_page/static/description/index.html b/document_page/static/description/index.html index 82000774039..9803cb2c417 100644 --- a/document_page/static/description/index.html +++ b/document_page/static/description/index.html @@ -8,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -274,7 +275,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -300,7 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -402,8 +403,8 @@

Usage

  • Go to Knowledge menu
  • Click on Categories to create the document’s category you need with the template
  • -
  • Click on Pages to create pages and select the previous category to -use the template
  • +
  • Click on Pages to create pages and select the previous category to use +the template
  • @@ -458,7 +459,9 @@

    Other credits

    Maintainers

    This module is maintained by the OCA.

    -Odoo Community Association + +Odoo Community Association +

    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 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.esm.js b/document_page/static/src/js/document_page_kanban_controller.esm.js new file mode 100644 index 00000000000..0b7884cb3a3 --- /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 00000000000..957bef03c7a --- /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 1156d6a6d8a..1d6d8e653f3 100644 --- a/document_page/views/document_page.xml +++ b/document_page/views/document_page.xml @@ -45,7 +45,12 @@ /> - +

    diff --git a/document_page/views/document_page_category.xml b/document_page/views/document_page_category.xml index 1e0a199e428..1f0528c8470 100644 --- a/document_page/views/document_page_category.xml +++ b/document_page/views/document_page_category.xml @@ -97,7 +97,7 @@ document.page.browse.kanban document.page - + @@ -152,35 +152,13 @@

    - +
    @@ -219,6 +197,10 @@
    + + +
      + @@ -302,7 +284,7 @@ />