3
0
Fork 0

[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.1
15.0-ocabot-merge-pr-2789-by-pedrobaeza-bump-patch
Lois Rilo 2020-09-04 09:05:08 +02:00 committed by Jasmin Solanki
parent ba40da64a6
commit e738edc513
5 changed files with 16 additions and 4 deletions

View File

@ -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
~~~~~~~~~~~

View File

@ -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",

View File

@ -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>

View File

@ -435,6 +435,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<li>Pablo Fuentes &lt;<a class="reference external" href="mailto:pablo&#64;studio73.es">pablo&#64;studio73.es</a>&gt;</li>
<li>Akim Juillerat &lt;<a class="reference external" href="mailto:akim.juillerat&#64;camptocamp.com">akim.juillerat&#64;camptocamp.com</a>&gt;</li>
<li>Enric Tobella &lt;<a class="reference external" href="mailto:etobella&#64;creublanca.es">etobella&#64;creublanca.es</a>&gt;</li>
<li>Lois Rilo &lt;<a class="reference external" href="mailto:lois.rilo&#64;forgeflow.com">lois.rilo&#64;forgeflow.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">

View File

@ -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;
},
})
);