[FW][FIX] web: restore backbutton support for OWL components

This merge prepares the ground for the restoration of the "backbutton" support for OWL components in enterprise in odoo/enterprise#15731.

Related to task ID: 2347640

closes odoo/odoo#64550

Forward-port-of: odoo/odoo#64465
Related: odoo/enterprise#15766
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
This commit is contained in:
Odoo's Mergebot
2021-01-14 18:35:24 +01:00
committed by GitHub
2 changed files with 14 additions and 6 deletions
+4 -2
View File
@@ -1,6 +1,8 @@
odoo.define('web.OwlDialog', function () {
odoo.define('web.OwlDialog', function (require) {
"use strict";
const patchMixin = require('web.patchMixin');
const { Component, hooks, misc } = owl;
const { Portal } = misc;
const { useExternalListener, useRef } = hooks;
@@ -269,5 +271,5 @@ odoo.define('web.OwlDialog', function () {
};
Dialog.template = 'web.OwlDialog';
return Dialog;
return patchMixin(Dialog);
});
+10 -4
View File
@@ -1,6 +1,8 @@
odoo.define('web.Popover', function () {
odoo.define('web.Popover', function (require) {
'use strict';
const patchMixin = require('web.patchMixin');
const { Component, hooks, misc, QWeb } = owl;
const { Portal } = misc;
const { useRef, useState } = hooks;
@@ -79,6 +81,10 @@ odoo.define('web.Popover', function () {
this._hasGlobalEventListeners = true;
}
_close() {
this.state.displayed = false;
}
/**
* Computes the popover according to its props. This method will try to position the
* popover as requested (according to the `position` props). If the requested position
@@ -184,7 +190,7 @@ odoo.define('web.Popover', function () {
if (this.popoverRef.el && this.popoverRef.el.contains(ev.target)) {
return;
}
this.state.displayed = false;
this._close();
}
/**
@@ -192,7 +198,7 @@ odoo.define('web.Popover', function () {
* @param {Event} ev
*/
_onPopoverClose(ev) {
this.state.displayed = false;
this._close();
}
/**
@@ -312,5 +318,5 @@ odoo.define('web.Popover', function () {
QWeb.registerComponent('Popover', Popover);
return Popover;
return patchMixin(Popover);
});