details: https://code.tryton.org/tryton/commit/96b6d4d04bfc
branch: 7.0
user: Cédric Krier <[email protected]>
date: Fri Jul 24 16:10:12 2026 +0200
description:
Use Text field for HTML content of report record
The field must contain strings in order to allow edition with the HTML
editor.
Closes #14922
(grafted from 73b5636cf6abe1ea23f05bab04772129a5178e11)
diffstat:
trytond/trytond/ir/action.py | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diffs (33 lines):
diff -r bc9b43e84e3c -r 96b6d4d04bfc trytond/trytond/ir/action.py
--- a/trytond/trytond/ir/action.py Wed Jul 22 12:28:03 2026 +0200
+++ b/trytond/trytond/ir/action.py Fri Jul 24 16:10:12 2026 +0200
@@ -484,7 +484,7 @@
'get_report_content', setter='set_report_content')
report_content_name = fields.Function(fields.Char('Content Name'),
'on_change_with_report_content_name')
- report_content_html = fields.Function(fields.Binary(
+ report_content_html = fields.Function(fields.Text(
"Content HTML",
states={
'invisible': ~Eval('template_extension').in_(
@@ -646,11 +646,18 @@
@classmethod
def get_report_content_html(cls, reports, name):
- return cls.get_report_content(reports, name[:-5])
+ contents = cls.get_report_content(reports, name[:-5])
+ for report_id, content in contents.items():
+ if isinstance(content, bytes):
+ try:
+ contents[report_id] = content.decode('utf-8')
+ except UnicodeDecodeError:
+ pass
+ return contents
@classmethod
def set_report_content_html(cls, reports, name, value):
- if value is not None:
+ if isinstance(value, str):
value = value.encode('utf-8')
cls.set_report_content(reports, name[:-5], value)