Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
2516 Lượt xem


it working fine odoo15 but not in 16
 ##js##

odoo.define("web_widget_plotly_chart.widget_plotly", 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);
},
_renderEdit: function () {
var val = this.value;
this.$el.html(val);
},
});
fieldRegistry.add("plotly_chart", PlotlyChartWidget);
return {
PlotlyChartWidget: PlotlyChartWidget,
};
});



**view side **

name="plotly_chart" widget="plotly_chart" nolabel="1"/>

**python side **

plotly_chart = fields.Text(
string='Plotly Chart',
compute
='_compute_plotly_chart',
)
def _compute_plotly_chart(self):
for rec in self:
data = [{'x': [1, 2, 3], 'y': [2, 3, 4]}]
rec.plotly_chart = plotly.offline.plot(data,
include_plotlyjs
=False,
output_type
='div')

##error##
Missing widget: plotly_chart for field of type text

kindly help me



Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

Please download and use or compare the v16 of this module from this link:  https://github.com/LevelPrime/web/tree/16.0-mig-web_widget_plotly_chart/web_widget_plotly_chart


After this review and approval, this will be available in this path:  https://github.com/OCA/web/tree/16.0

Thanks

Ảnh đại diện
Huỷ bỏ
Tác giả

Thankyou for helping it working!

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 7 23
2741
0
thg 10 24
1204
0
thg 9 24
979
0
thg 9 23
2147
0
thg 8 23
1296