[FIX] document_page_reference: assure content or content_parsed is visible

This commit is contained in:
Miquel Raïch 2022-11-24 15:02:14 +01:00 committed by Anusha
parent 191b41a391
commit 8cef3f268b
2 changed files with 12 additions and 3 deletions

View File

@ -62,7 +62,14 @@ class DocumentPage(models.Model):
@api.depends("history_head")
def _compute_content_parsed(self):
for record in self:
record.content_parsed = record.get_content()
content = record.get_content()
if content == "<p>" and self.content != "<p>":
_logger.error(
"Template from page with id = %s cannot be processed correctly"
% self.id
)
content = self.content
record.content_parsed = content
@api.constrains("reference")
def _check_reference(self):
@ -111,7 +118,9 @@ class DocumentPage(models.Model):
template = mako_env.from_string(tools.ustr(content))
return template.render(self._get_template_variables())
except Exception:
_logger.error("Template from page %s cannot be processed" % self.id)
_logger.error(
"Template from page with id = %s cannot be processed" % self.id
)
return self.content
def get_raw_content(self):

View File

@ -30,7 +30,7 @@
<field name="inherit_id" ref="document_page.view_wiki_menu_form" />
<field name="arch" type="xml">
<field name="content" position="attributes">
<attribute name="invisible">1</attribute>
<attribute name="class">oe_edit_only</attribute>
</field>
<field name="content" position="before">
<field