[FIX] website: fix ctx argument
In the call to Chart.js we pass a ctx which should be a DOM element, however we pass `null` as the ctx. It seems that what happens is that we look for the DOM element inside the `document` (via getElementById) but this element is not yet inserted into the document, hence this returns `null`. Since we already have a reference to the canvas element which should be used as ctx, we can probably just reuse this reference closes odoo/odoo#36072 Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
This commit is contained in:
@@ -185,7 +185,7 @@ var Dashboard = AbstractAction.extend({
|
||||
};
|
||||
});
|
||||
|
||||
var ctx = document.getElementById(chart_id);
|
||||
var ctx = this.$canvas[0];
|
||||
this.chart = new Chart(ctx, {
|
||||
type: 'line',
|
||||
data: {
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
odoo.define("website.tour.backend_dashboard", function (require) {
|
||||
"use strict";
|
||||
|
||||
var tour = require("web_tour.tour");
|
||||
|
||||
tour.register("backend_dashboard", {
|
||||
test: true,
|
||||
url: "/web",
|
||||
}, [tour.STEPS.SHOW_APPS_MENU_ITEM,
|
||||
{
|
||||
trigger: 'a[data-menu-xmlid="website.menu_website_configuration"]',
|
||||
run: 'click',
|
||||
}, {
|
||||
trigger: '.dropdown-toggle[data-menu-xmlid="website.menu_dashboard"]',
|
||||
run: 'click',
|
||||
}, {
|
||||
trigger: '.dropdown-item[data-menu-xmlid="website.menu_website_google_analytics"]',
|
||||
content: 'Check if traceback',
|
||||
run: 'click',
|
||||
}]);
|
||||
});
|
||||
@@ -109,3 +109,6 @@ class TestUi(odoo.tests.HttpCase):
|
||||
])]
|
||||
})
|
||||
self.start_tour("/", 'restricted_editor', login='restricted')
|
||||
|
||||
def test_04_backend_dashboard(self):
|
||||
self.start_tour("/", 'backend_dashboard', login='admin')
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
<script type="text/javascript" src="/website/static/tests/tours/rte.js"/>
|
||||
<script type="text/javascript" src="/website/static/tests/tours/html_editor.js"/>
|
||||
<script type="text/javascript" src="/website/static/tests/tours/restricted_editor.js"/>
|
||||
<script type="text/javascript" src="/website/static/tests/tours/dashboard_tour.js"/>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user