[FIX] web_drop_target: Hide it when it is not the current action or has no chatter

This commit is contained in:
Enric Tobella
2021-11-22 14:42:44 +01:00
parent f59a417965
commit 5553395100

View File

@@ -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;
@@ -140,7 +140,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,
@@ -156,6 +164,10 @@ odoo.define("web_drop_target", function(require) {
}
},
_checkDragOver: function() {
return true;
},
/**
* @private
* @param {MouseEvent} ev
@@ -309,6 +321,9 @@ odoo.define("web_drop_target", function(require) {
_get_record_id: function() {
return this.renderer.state.res_id;
},
_checkDragOver: function() {
return this.renderer.chatter;
},
})
);