diff --git a/addons/web/static/src/legacy/js/core/owl_dialog.js b/addons/web/static/src/legacy/js/core/owl_dialog.js
index 5939b18c098..d5f15bf90d8 100644
--- a/addons/web/static/src/legacy/js/core/owl_dialog.js
+++ b/addons/web/static/src/legacy/js/core/owl_dialog.js
@@ -105,6 +105,9 @@ odoo.define('web.OwlDialog', function (require) {
* @private
*/
_close() {
+ if (this.props.onClosed) {
+ this.props.onClosed();
+ }
this.trigger('dialog-closed');
}
@@ -149,6 +152,12 @@ odoo.define('web.OwlDialog', function (require) {
}
}
+ _onDialogClosed() {
+ if (this.props.onClosed) {
+ this.props.onClosed();
+ }
+ }
+
/**
* @private
*/
@@ -248,6 +257,7 @@ odoo.define('web.OwlDialog', function (require) {
backdrop: { validate: b => ['static', true, false].includes(b) },
contentClass: { type: String, optional: 1 },
fullscreen: { type: Boolean, optional: 1 },
+ onClosed: { type: Function, optional: 1 },
renderFooter: Boolean,
renderHeader: Boolean,
size: { validate: s => ['extra-large', 'large', 'medium', 'small'].includes(s) },
diff --git a/addons/web/static/src/legacy/js/core/popover.js b/addons/web/static/src/legacy/js/core/popover.js
index 3c6a4386364..e0bc95e6b5c 100644
--- a/addons/web/static/src/legacy/js/core/popover.js
+++ b/addons/web/static/src/legacy/js/core/popover.js
@@ -81,6 +81,9 @@ odoo.define('web.Popover', function (require) {
_close() {
this.state.displayed = false;
+ if (this.props.onClosed) {
+ this.props.onClosed();
+ }
this.trigger('o-popover-closed');
}
@@ -173,8 +176,14 @@ odoo.define('web.Popover', function (require) {
_onClick(ev) {
this.state.displayed = !this.state.displayed;
if (this.state.displayed) {
+ if (this.props.onOpened) {
+ this.props.onOpened();
+ }
this.trigger('o-popover-opened');
} else {
+ if (this.props.onClosed) {
+ this.props.onClosed();
+ }
this.trigger('o-popover-closed');
}
}
@@ -319,6 +328,14 @@ odoo.define('web.Popover', function (require) {
position: 'bottom',
};
Popover.props = {
+ onClosed: {
+ type: Function,
+ optional: true,
+ },
+ onOpened: {
+ type: Function,
+ optional: true,
+ },
popoverClass: {
type: String,
optional: true,
diff --git a/addons/web/static/src/legacy/xml/base.xml b/addons/web/static/src/legacy/xml/base.xml
index 164c0d9958b..eb34cb1563b 100644
--- a/addons/web/static/src/legacy/xml/base.xml
+++ b/addons/web/static/src/legacy/xml/base.xml
@@ -242,7 +242,7 @@
-