[IMP] web_widget_mpld3_chart: Move widget from CharField to Component(Json field)

This commit is contained in:
BernatPForgeFlow
2023-11-30 11:57:10 +01:00
parent 972f688dbe
commit 4384f709b7
5 changed files with 29 additions and 27 deletions

View File

@@ -2,7 +2,6 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import json
import logging
from odoo import api, models
@@ -26,8 +25,7 @@ class AbstractMpld3Parser(models.AbstractModel):
html_string = mpld3.fig_to_html(figure, no_extras=True, include_libraries=False)
soup = BeautifulSoup(html_string, "lxml")
json_data = {
"style": soup.style.decode(),
"div": str(soup.div),
"script": soup.script.decode_contents(),
}
return json.dumps(json_data)
return json_data