mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[16.0][MIG] Migration to v16.0
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
|
||||
<title>Web Widget Plotly</title>
|
||||
<style type="text/css">
|
||||
|
||||
@@ -367,9 +367,9 @@ ul.auto-toc {
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/web/tree/14.0/web_widget_plotly_chart"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/web-14-0/web-14-0-web_widget_plotly_chart"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/162/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/web/tree/16.0/web_widget_plotly_chart"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_widget_plotly_chart"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runboat.odoo-community.org/webui/builds.html?repo=OCA/web&target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module add the possibility to insert Plotly charts into Odoo standard views.</p>
|
||||
<img alt="Plotly Chart inserted into an Odoo view" src="https://raw.githubusercontent.com/OCA/web/14.0/web_widget_plotly_chart/static/description/example.png" style="width: 600px;" />
|
||||
<img alt="Plotly Chart inserted into an Odoo view" src="https://raw.githubusercontent.com/OCA/web/16.0/web_widget_plotly_chart/static/description/example.png" style="width: 600px;" />
|
||||
<p><a class="reference external" href="https://plot.ly/">Plotly</a> is a Python interactive visualization
|
||||
library built on top of d3.js and stack.gl, plotly.js is a high-level,
|
||||
declarative charting library. plotly.js ships with over 40 chart types,
|
||||
@@ -435,7 +435,7 @@ plotly chart:</p>
|
||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>.
|
||||
In case of trouble, please check there if your issue has already been reported.
|
||||
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_widget_plotly_chart%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_widget_plotly_chart%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||
</div>
|
||||
<div class="section" id="credits">
|
||||
@@ -471,7 +471,7 @@ mission is to support the collaborative development of Odoo features and
|
||||
promote its widespread use.</p>
|
||||
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
|
||||
<p><a class="reference external" href="https://github.com/robyf70"><img alt="robyf70" src="https://github.com/robyf70.png?size=40px" /></a></p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/14.0/web_widget_plotly_chart">OCA/web</a> project on GitHub.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/16.0/web_widget_plotly_chart">OCA/web</a> project on GitHub.</p>
|
||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
42
web_widget_plotly_chart/static/src/js/widget_plotly.esm.js
Normal file
42
web_widget_plotly_chart/static/src/js/widget_plotly.esm.js
Normal file
@@ -0,0 +1,42 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import {loadJS} from "@web/core/assets";
|
||||
import {registry} from "@web/core/registry";
|
||||
|
||||
import {Component, onPatched, onWillStart, useEffect, useRef} from "@odoo/owl";
|
||||
|
||||
export class PlotlyChartWidgetField extends Component {
|
||||
setup() {
|
||||
this.divRef = useRef("plotly");
|
||||
|
||||
onWillStart(async () => {
|
||||
await loadJS(
|
||||
"/web_widget_plotly_chart/static/src/lib/plotly/plotly-2.18.2.min.js"
|
||||
);
|
||||
this.updatePlotly(this.props.value);
|
||||
});
|
||||
|
||||
onPatched(() => {
|
||||
this.updatePlotly(this.props.value);
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
this.updatePlotly(this.props.value);
|
||||
});
|
||||
}
|
||||
updatePlotly(value) {
|
||||
const value_html = $(value);
|
||||
const div = value_html.find(".plotly-graph-div").get(0).outerHTML || "";
|
||||
const script = value_html.find("script").get(0).textContent || "";
|
||||
|
||||
if (this.divRef.el) {
|
||||
this.divRef.el.innerHTML = div;
|
||||
new Function(script)();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PlotlyChartWidgetField.template = "web_widget_plotly_chart.PlotlyChartWidgetField";
|
||||
PlotlyChartWidgetField.supportedTypes = ["char", "text"];
|
||||
|
||||
registry.category("fields").add("plotly_chart", PlotlyChartWidgetField);
|
||||
@@ -1,17 +0,0 @@
|
||||
odoo.define("web_widget_plotly_chart", function (require) {
|
||||
"use strict";
|
||||
|
||||
var fieldRegistry = require("web.field_registry");
|
||||
var AbstractField = require("web.AbstractField");
|
||||
|
||||
var PlotlyChartWidget = AbstractField.extend({
|
||||
_renderReadonly: function () {
|
||||
var val = this.value;
|
||||
this.$el.html(val);
|
||||
},
|
||||
});
|
||||
fieldRegistry.add("plotly_chart", PlotlyChartWidget);
|
||||
return {
|
||||
PlotlyChartWidget: PlotlyChartWidget,
|
||||
};
|
||||
});
|
||||
8
web_widget_plotly_chart/static/src/js/widget_plotly.xml
Normal file
8
web_widget_plotly_chart/static/src/js/widget_plotly.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="web_widget_plotly_chart.PlotlyChartWidgetField" owl="1">
|
||||
<div t-ref="plotly" />
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
8
web_widget_plotly_chart/static/src/lib/plotly/plotly-2.18.2.min.js
vendored
Normal file
8
web_widget_plotly_chart/static/src/lib/plotly/plotly-2.18.2.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user