[FIX] document_page_reference: migrate widget to OWL#601
Open
[FIX] document_page_reference: migrate widget to OWL#601
Conversation
Contributor
|
Hi @etobella, |
The legacy JS widget registered in web.field_registry was not picked up by the OWL form view parser, causing "Missing widget: document_page_reference" warnings and the content_parsed field not rendering at all. Changes: - Migrate JS widget from legacy field_registry to OWL registry - Fix retargetLinks adding target="_blank" to internal reference links - Override _get_page_index to use oe_direct_line links in category pages - Replace oe_read_only/oe_edit_only CSS classes with proper attrs/invisible - Add tour test for reference link navigation - Fix _compute_content_parsed using self instead of record in loop
77f41b2 to
54c8843
Compare
html_escape() returns markupsafe.Markup, which auto-escapes plain str when concatenated. Use Markup() for HTML literals to prevent the index links from being double-escaped. Also add sanitize=False to content_parsed field to match content field.
54c8843 to
910ad00
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The legacy JS widget registered in
web.field_registryis not picked up by the OWL form view parser in Odoo 16, causing:Missing widget: document_page_reference for field of type htmlwarning in browser consolecontent_parsedfield not rendering — users see raw${reference}text instead of clickable linksChanges
odoo.define+web.field_registrywith@odoo-module+registry.category("fields"), extendingHtmlFieldfrom@web_editorretargetLinksinterference: The baseHtmlFieldaddstarget="_blank"to all<a>tags viaretargetLinks. The new widget removes this attribute from internal.oe_direct_linelinks so reference navigation stays within the same window_get_page_index: Category index links now useoe_direct_lineclass withdata-oe-model/data-oe-idattributes, making them compatible with the widget's click handleroe_read_only/oe_edit_onlyclasses replaced withreadonly="1"andattrs/invisiblefor proper field visibility in Odoo 16 form views_compute_content_parsedbug: Was usingselfinstead ofrecordinside the loop, causing incorrect computation for multi-record sets<a>tags and category index links are presentTest plan
${reference_name}referencesdocument_page_referencetest suite (Python + tour)