From 3f2c9624fe4a9e6775bf7089f1a2c39a700ff17d Mon Sep 17 00:00:00 2001 From: Enric Tobella Date: Mon, 22 Nov 2021 14:42:44 +0100 Subject: [PATCH] [FIX] web_drop_target: Hide it when it is not the current action or has no chatter --- .../static/src/js/web_drop_target.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/web_drop_target/static/src/js/web_drop_target.js b/web_drop_target/static/src/js/web_drop_target.js index 0f689d083..a12da649f 100644 --- a/web_drop_target/static/src/js/web_drop_target.js +++ b/web_drop_target/static/src/js/web_drop_target.js @@ -5,7 +5,7 @@ odoo.define("web_drop_target", function (require) { "use strict"; - + const ActionManager = require("web.ActionManager"); const FormController = require("web.FormController"); const core = require("web.core"); const qweb = core.qweb; @@ -152,7 +152,15 @@ odoo.define("web_drop_target", function (require) { */ _onBodyFileDragover: function (ev) { ev.preventDefault(); - if (_.isEmpty(this._get_drop_items(ev))) { + const actionManager = this.findAncestor(function (ancestor) { + return ancestor instanceof ActionManager; + }); + const controller = actionManager.currentDialogController; + if ( + _.isEmpty(this._get_drop_items(ev)) && + this._checkDragOver() && + (controller == undefined || controller.jsID === this.controllerID) + ) { const drop_zone_offset = this.$drop_zone.offset(); const overlay_css = { top: drop_zone_offset.top, @@ -168,6 +176,10 @@ odoo.define("web_drop_target", function (require) { } }, + _checkDragOver: function () { + return true; + }, + /** * @private * @param {MouseEvent} ev @@ -317,6 +329,9 @@ odoo.define("web_drop_target", function (require) { _get_record_id: function () { return this.renderer.state.res_id; }, + _checkDragOver: function () { + return this.renderer._chatterContainerComponent; + }, }) );