[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) <qsm@odoo.com>
This commit is contained in:
qsm-odoo
2023-05-02 14:47:13 +02:00
parent 4ff9458dc7
commit 8b9bd11e13
@@ -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;