diff --git a/document_page_reference/README.rst b/document_page_reference/README.rst
index 53b9493b62a..2d259d2844a 100644
--- a/document_page_reference/README.rst
+++ b/document_page_reference/README.rst
@@ -1,7 +1,3 @@
-.. image:: https://odoo-community.org/readme-banner-image
- :target: https://odoo-community.org/get-involved?utm_source=readme
- :alt: Odoo Community Association
-
=======================
Document Page Reference
=======================
@@ -17,7 +13,7 @@ Document Page Reference
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
-.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
+.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github
diff --git a/document_page_reference/__manifest__.py b/document_page_reference/__manifest__.py
index dea07a92925..0d13672558f 100644
--- a/document_page_reference/__manifest__.py
+++ b/document_page_reference/__manifest__.py
@@ -18,6 +18,9 @@
"web.assets_backend": [
"document_page_reference/static/src/js/**/*",
],
+ "web.assets_tests": [
+ "document_page_reference/static/tests/**/*",
+ ],
},
"maintainers": ["etobella"],
}
diff --git a/document_page_reference/models/document_page.py b/document_page_reference/models/document_page.py
index 5c5fd37e267..aeee8e71e07 100644
--- a/document_page_reference/models/document_page.py
+++ b/document_page_reference/models/document_page.py
@@ -3,6 +3,8 @@
import logging
+from markupsafe import Markup
+
from odoo import _, api, fields, models, tools
from odoo.exceptions import ValidationError
from odoo.tools.misc import html_escape
@@ -52,7 +54,32 @@ class DocumentPage(models.Model):
reference = fields.Char(
help="Used to find the document, it can contain letters, numbers and _"
)
- content_parsed = fields.Html(compute="_compute_content_parsed")
+ content_parsed = fields.Html(compute="_compute_content_parsed", sanitize=False)
+
+ def _get_page_index(self, link=True):
+ """Override to use oe_direct_line links compatible with the widget."""
+ self.ensure_one()
+ index = [
+ Markup("
") + subpage._get_page_index() + Markup("")
+ for subpage in self.child_ids
+ ]
+ r = Markup("")
+ if link:
+ r = (
+ Markup(
+ ''
+ )
+ % (
+ self._name,
+ self.id,
+ )
+ + html_escape(self.name)
+ + Markup("")
+ )
+ if index:
+ r += Markup("") + Markup("").join(index) + Markup("
")
+ return r
def get_formview_action(self, access_uid=None):
res = super().get_formview_action(access_uid)
@@ -60,17 +87,20 @@ def get_formview_action(self, access_uid=None):
res["views"] = [(view_id, "form")]
return res
- @api.depends("history_head")
+ @api.depends("history_head", "type")
def _compute_content_parsed(self):
for record in self:
- content = record.get_content()
- if content == "" and self.content != "
":
- _logger.error(
- "Template from page with id = %s cannot be processed correctly"
- % self.id
- )
- content = self.content
- record.content_parsed = content
+ if record.type == "category":
+ record.content_parsed = record.content
+ else:
+ content = record.get_content()
+ if content == "
" and record.content != "
":
+ _logger.error(
+ "Template from page with id = %s cannot be "
+ "processed correctly" % record.id
+ )
+ content = record.content
+ record.content_parsed = content
@api.constrains("reference")
def _check_reference(self):
diff --git a/document_page_reference/static/description/index.html b/document_page_reference/static/description/index.html
index dfb52bcbef2..568ef4db19e 100644
--- a/document_page_reference/static/description/index.html
+++ b/document_page_reference/static/description/index.html
@@ -3,16 +3,15 @@
-README.rst
+Document Page Reference
-
+
+
Document Page Reference
-
-
-
-
-
-
Document Page Reference
-

+

This module allows to add a reference name on documents and simplifies the link
between document pages.
Table of contents
@@ -391,13 +385,13 @@
Document Page Reference
-
+
When editing a document page add elements like ${XXX} where XXX is the reference
of another page. Now, when viewing the document, it will link directly to the page.
Also, the name will be parsed as the display name.
-
+
Bugs are tracked on GitHub Issues.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
@@ -405,25 +399,23 @@
Do not contact contributors directly about support or help with technical issues.
-
+
-
+
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.
@@ -434,6 +426,5 @@
-