From 8b9bd11e138cee5de3ad0a217e7d92018e413b70 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Tue, 25 Apr 2023 13:09:53 +0000 Subject: [PATCH] [FIX] website: restore wrongly upgraded countdown snippets With the BS5 upgrade script of 16.0, countdowns' data-display may have been converted to data-bs-display by mistake. This will fix the DOM at page load for good measures, maybe even allowing to remove this code in a few years as hopefully all current countdowns will have been removed or edited (or when a proper upgrade script in a future version of Odoo will be made, if necessary). opw-3240041 opw-3240532 opw-3258751 opw-3272731 closes odoo/odoo#119767 X-original-commit: ce506f32e3471eea1785312d4140417eba0ce355 Signed-off-by: Quentin Smetz (qsm) --- addons/website/static/src/snippets/s_countdown/000.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/addons/website/static/src/snippets/s_countdown/000.js b/addons/website/static/src/snippets/s_countdown/000.js index d83a8f7d227..d9a9ab5dbd4 100644 --- a/addons/website/static/src/snippets/s_countdown/000.js +++ b/addons/website/static/src/snippets/s_countdown/000.js @@ -23,6 +23,17 @@ const CountdownWidget = publicWidget.Widget.extend({ this.endTime = parseInt(this.el.dataset.endTime); this.size = parseInt(this.el.dataset.size); this.display = this.el.dataset.display; + if (!this.display && this.el.dataset.bsDisplay) { + // With the BS5 upgrade script of 16.0, countdowns' data-display may + // have been converted to data-bs-display by mistake. This will fix + // the DOM for good measures, maybe even allowing to remove this + // code in a few years as hopefully all current countdowns will have + // been removed or edited (or when a proper upgrade script in a + // future version of Odoo will be made, if necessary). TODO. + this.display = this.el.dataset.bsDisplay; + delete this.el.dataset.bsDisplay; + this.el.dataset.display = this.display; + } this.layout = this.el.dataset.layout; this.layoutBackground = this.el.dataset.layoutBackground;