From a3f2a7b83ad87a2458602312475ee3e0ca67b261 Mon Sep 17 00:00:00 2001 From: Pierre Paridans Date: Thu, 14 Jan 2021 09:13:25 +0000 Subject: [PATCH] [FIX] web: make Popover patchable Allows customization for enterprise. Task ID: 2347640 X-original-commit: 5ac640611e21e6a7ac1c02e632e4550155c98f9a --- addons/web/static/src/js/core/popover.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/js/core/popover.js b/addons/web/static/src/js/core/popover.js index 6210ce940b5..d2102b56d3c 100644 --- a/addons/web/static/src/js/core/popover.js +++ b/addons/web/static/src/js/core/popover.js @@ -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); });