forked from Techsystech/web
[13.0][FIX] web_drop_target: improve extensibility
when using the mixin in other widgets you may need to define a different way to get the record id. [UPD] README.rst web_drop_target 13.0.1.1.115.0-ocabot-merge-pr-2789-by-pedrobaeza-bump-patch
parent
ba40da64a6
commit
e738edc513
|
@ -88,6 +88,7 @@ Contributors
|
|||
* Pablo Fuentes <pablo@studio73.es>
|
||||
* Akim Juillerat <akim.juillerat@camptocamp.com>
|
||||
* Enric Tobella <etobella@creublanca.es>
|
||||
* Lois Rilo <lois.rilo@forgeflow.com>
|
||||
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
{
|
||||
"name": "Drop target support",
|
||||
"version": "13.0.1.1.0",
|
||||
"version": "13.0.1.1.1",
|
||||
"author": "Therp BV,Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/web",
|
||||
"license": "AGPL-3",
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
* Pablo Fuentes <pablo@studio73.es>
|
||||
* Akim Juillerat <akim.juillerat@camptocamp.com>
|
||||
* Enric Tobella <etobella@creublanca.es>
|
||||
* Lois Rilo <lois.rilo@forgeflow.com>
|
||||
|
|
|
@ -435,6 +435,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
|||
<li>Pablo Fuentes <<a class="reference external" href="mailto:pablo@studio73.es">pablo@studio73.es</a>></li>
|
||||
<li>Akim Juillerat <<a class="reference external" href="mailto:akim.juillerat@camptocamp.com">akim.juillerat@camptocamp.com</a>></li>
|
||||
<li>Enric Tobella <<a class="reference external" href="mailto:etobella@creublanca.es">etobella@creublanca.es</a>></li>
|
||||
<li>Lois Rilo <<a class="reference external" href="mailto:lois.rilo@forgeflow.com">lois.rilo@forgeflow.com</a>></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
|
|
|
@ -52,7 +52,7 @@ odoo.define("web_drop_target", function(require) {
|
|||
},
|
||||
|
||||
_get_drop_items: function(e) {
|
||||
if (this.renderer.state.res_id) {
|
||||
if (this._get_record_id()) {
|
||||
var self = this,
|
||||
dataTransfer = e.originalEvent.dataTransfer,
|
||||
drop_items = [];
|
||||
|
@ -133,6 +133,12 @@ odoo.define("web_drop_target", function(require) {
|
|||
reader.readAsArrayBuffer(file);
|
||||
},
|
||||
|
||||
_get_record_id: function() {
|
||||
// Implement when including this mixin. Return the record ID.
|
||||
console.log("'_get_record_id': Not Implemented");
|
||||
return false;
|
||||
},
|
||||
|
||||
_add_overlay: function() {
|
||||
var self = this;
|
||||
if (!this._drop_overlay) {
|
||||
|
@ -140,7 +146,7 @@ odoo.define("web_drop_target", function(require) {
|
|||
view_manager = jQuery(".o_view_manager_content");
|
||||
this._drop_overlay = jQuery(
|
||||
qweb.render("web_drop_target.drop_overlay", {
|
||||
id: self.renderer.state.res_id,
|
||||
id: self._get_record_id(),
|
||||
})
|
||||
);
|
||||
var o_content_position = o_content.position();
|
||||
|
@ -150,7 +156,7 @@ odoo.define("web_drop_target", function(require) {
|
|||
width: view_manager.width(),
|
||||
height: view_manager.height(),
|
||||
});
|
||||
if (!this.renderer.state.res_id) {
|
||||
if (!this._get_record_id()) {
|
||||
this._drop_overlay.css("background", "#FF000020");
|
||||
}
|
||||
o_content.append(this._drop_overlay);
|
||||
|
@ -181,6 +187,9 @@ odoo.define("web_drop_target", function(require) {
|
|||
);
|
||||
});
|
||||
},
|
||||
_get_record_id: function() {
|
||||
return this.renderer.state.res_id;
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue