3
0
Fork 0

[16.0][MIG] Migration to v16.0

16.0
Roberto Fichera 2023-03-03 11:18:33 +01:00
parent 60428a2db1
commit ff575d4fd7
12 changed files with 89 additions and 122 deletions

2
requirements.txt 100644
View File

@ -0,0 +1,2 @@
# generated from manifests external_dependencies
plotly==5.13.1

View File

@ -0,0 +1 @@
../../../../web_widget_plotly_chart

View File

@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

View File

@ -14,20 +14,20 @@ Web Widget Plotly
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3 :alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
:target: https://github.com/OCA/web/tree/14.0/web_widget_plotly_chart :target: https://github.com/OCA/web/tree/16.0/web_widget_plotly_chart
:alt: OCA/web :alt: OCA/web
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/web-14-0/web-14-0-web_widget_plotly_chart :target: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_widget_plotly_chart
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/162/14.0 :target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/web&target_branch=16.0
:alt: Try me on Runbot :alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
This module add the possibility to insert Plotly charts into Odoo standard views. This module add the possibility to insert Plotly charts into Odoo standard views.
.. image:: https://raw.githubusercontent.com/OCA/web/14.0/web_widget_plotly_chart/static/description/example.png .. image:: https://raw.githubusercontent.com/OCA/web/16.0/web_widget_plotly_chart/static/description/example.png
:alt: Plotly Chart inserted into an Odoo view :alt: Plotly Chart inserted into an Odoo view
:width: 600 px :width: 600 px
@ -86,7 +86,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_. Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
In case of trouble, please check there if your issue has already been reported. 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 If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <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 <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**>`_.
Do not contact contributors directly about support or help with technical issues. Do not contact contributors directly about support or help with technical issues.
@ -133,6 +133,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-robyf70| |maintainer-robyf70|
This module is part of the `OCA/web <https://github.com/OCA/web/tree/14.0/web_widget_plotly_chart>`_ project on GitHub. This module is part of the `OCA/web <https://github.com/OCA/web/tree/16.0/web_widget_plotly_chart>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -5,13 +5,17 @@
"maintainers": ["robyf70"], "maintainers": ["robyf70"],
"website": "https://github.com/OCA/web", "website": "https://github.com/OCA/web",
"category": "Web", "category": "Web",
"version": "14.0.1.0.0", "version": "16.0.1.0.0",
"depends": ["web"], "depends": ["web"],
"data": [ "data": [],
"views/web_widget_plotly_chart.xml",
],
"external_dependencies": { "external_dependencies": {
"python": ["plotly==5.4.0"], "python": ["plotly==5.13.1"],
},
"assets": {
"web.assets_backend": [
"web_widget_plotly_chart/static/src/js/widget_plotly.esm.js",
"web_widget_plotly_chart/static/src/js/widget_plotly.xml",
],
}, },
"license": "LGPL-3", "license": "LGPL-3",
} }

View File

@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <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> <title>Web Widget Plotly</title>
<style type="text/css"> <style type="text/css">
@ -367,9 +367,9 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! 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&amp;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> <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 <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, 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, 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>. <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. 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 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> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <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> promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</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><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> <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>
</div> </div>

View 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);

View File

@ -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,
};
});

View 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>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template
id="assets_backend"
name="web_widget_plotly_chart assets"
inherit_id="web.assets_backend"
>
<xpath expr="." position="inside">
<!-- Library -->
<script
type="text/javascript"
src="/web_widget_plotly_chart/static/src/lib/plotly/plotly-2.7.0.min.js"
/>
<!-- Widget -->
<script
type="text/javascript"
src="/web_widget_plotly_chart/static/src/js/widget_plotly.js"
/>
</xpath>
</template>
</odoo>