3
0
Fork 0

[MIG] web_widget_bokeh_chart: Migration to 16.0

16.0
OriolMForgeFlow 2023-06-06 13:48:46 +02:00
parent c6e2c390dd
commit 4639a13698
18 changed files with 1451 additions and 1334 deletions

View File

@ -1,3 +1,3 @@
# generated from manifests external_dependencies
bokeh==3.1.1
plotly==5.13.1
bokeh==2.4.2

View File

@ -5,19 +5,20 @@
"name": "Web Widget Bokeh Chart",
"category": "Hidden",
"summary": "This widget allows to display charts using Bokeh library.",
"author": "ForgeFlow, " "Odoo Community Association (OCA)",
"version": "15.0.1.1.1",
"author": "ForgeFlow, " "Odoo Community Association (OCA), " "Creu Blanca",
"version": "16.0.1.0.0",
"maintainers": ["LoisRForgeFlow", "ChrisOForgeFlow"],
"development_status": "Production/Stable",
"website": "https://github.com/OCA/web",
"depends": ["web"],
"data": [],
"external_dependencies": {"python": ["bokeh==2.4.2"]},
"external_dependencies": {"python": ["bokeh==3.1.1"]},
"auto_install": False,
"license": "LGPL-3",
"assets": {
"web.assets_backend": [
"web_widget_bokeh_chart/static/src/js/web_widget_bokeh_chart.esm.js",
"web_widget_bokeh_chart/static/src/xml/bokeh.xml",
],
},
}

View File

@ -2,3 +2,6 @@
* Lois Rilo Antelo <lois.rilo@forgeflow.com>
* Artem Kostyuk <a.kostyuk@mobilunity.com>
* Christopher Ormaza <chris.ormaza@forgeflow.com>
* Enric Tobella <etobella@creublanca.es>
* Oriol Miranda Garrido <oriol.miranda@forgeflow.com>
* Bernat Puig Font <bernat.puig@forgeflow.com>

View File

@ -1,3 +1,3 @@
You need to install the python bokeh library::
pip3 install bokeh==2.4.2
pip3 install bokeh==3.1.1

View File

@ -1,32 +1,32 @@
/** @odoo-module **/
import basicFields from "web.basic_fields";
import fieldRegistry from "web.field_registry";
const BokehChartWidget = basicFields.FieldChar.extend({
jsLibs: [
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-2.4.2.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-api-2.4.2.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-widgets-2.4.2.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-tables-2.4.2.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-mathjax-2.4.2.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-gl-2.4.2.min.js",
],
_renderReadonly: function () {
try {
const val = JSON.parse(this.value);
this.$el.html(val.div);
const script = document.createElement("script");
script.setAttribute("type", "text/javascript");
if ("textContent" in script) script.textContent = val.script;
else script.text = val.script;
this.$el.append(script);
} catch (error) {
return this._super(...arguments);
}
},
});
fieldRegistry.add("bokeh_chart", BokehChartWidget);
import {CharField} from "@web/views/fields/char/char_field";
import {registry} from "@web/core/registry";
import {loadBundle} from "@web/core/assets";
const {onWillStart, markup} = owl;
class BokehChartWidget extends CharField {
setup() {
super.setup();
onWillStart(() =>
loadBundle({
jsLibs: [
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.1.1.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-api-3.1.1.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-widgets-3.1.1.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-tables-3.1.1.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-mathjax-3.1.1.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-gl-3.1.1.min.js",
],
})
);
}
get json_value() {
var value = JSON.parse(this.props.value);
value.div = markup(value.div.trim());
return value;
}
}
BokehChartWidget.template = "web_widget_bokeh_chart.BokehChartField";
registry.category("fields").add("bokeh_chart", BokehChartWidget);
export default BokehChartWidget;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">
<t t-name="web_widget_bokeh_chart.BokehChartField" owl="1">
<t t-out="json_value.div" />
<script type="text/javascript" t-out="json_value.script" />
</t>
</templates>