diff options
| author | RomainLibert <rli@odoo.com> | 2019-08-26 10:52:27 +0000 |
|---|---|---|
| committer | RomainLibert <rli@odoo.com> | 2019-08-28 11:13:18 +0000 |
| commit | 6aaef4a3d95a9c2eeae698bda6a4082470e82a48 (patch) | |
| tree | e3d05b9a756356558220a2a02f319f1375debae0 /addons/website/static | |
| parent | 85b5c9bbb4c558dec56de3351763496fc9e8fb1e (diff) | |
[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>
Diffstat (limited to 'addons/website/static')
| -rw-r--r-- | addons/website/static/src/js/backend/dashboard.js | 2 | ||||
| -rw-r--r-- | addons/website/static/tests/tours/dashboard_tour.js | 21 |
2 files changed, 22 insertions, 1 deletions
diff --git a/addons/website/static/src/js/backend/dashboard.js b/addons/website/static/src/js/backend/dashboard.js index dda40102904..28b9a55c8a4 100644 --- a/addons/website/static/src/js/backend/dashboard.js +++ b/addons/website/static/src/js/backend/dashboard.js @@ -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: { diff --git a/addons/website/static/tests/tours/dashboard_tour.js b/addons/website/static/tests/tours/dashboard_tour.js new file mode 100644 index 00000000000..a8566d63a97 --- /dev/null +++ b/addons/website/static/tests/tours/dashboard_tour.js @@ -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', +}]); +}); |
