diff --git a/web_widget_one2many_product_picker_sale_stock/README.rst b/web_widget_one2many_product_picker_sale_stock/README.rst
index 4db82a204..f7784e801 100644
--- a/web_widget_one2many_product_picker_sale_stock/README.rst
+++ b/web_widget_one2many_product_picker_sale_stock/README.rst
@@ -40,7 +40,7 @@ Install and use it
Widget options:
~~~~~~~~~~~~~~~
-* show_sale_stock > Enable/Disable show the stock
+* show_sale_stock > Enable/Disable show the stock (default: true)
Bug Tracker
===========
diff --git a/web_widget_one2many_product_picker_sale_stock/readme/USAGE.rst b/web_widget_one2many_product_picker_sale_stock/readme/USAGE.rst
index 444dc6d6e..34912d2d8 100644
--- a/web_widget_one2many_product_picker_sale_stock/readme/USAGE.rst
+++ b/web_widget_one2many_product_picker_sale_stock/readme/USAGE.rst
@@ -3,4 +3,4 @@ Install and use it
Widget options:
~~~~~~~~~~~~~~~
-* show_sale_stock > Enable/Disable show the stock
+* show_sale_stock > Enable/Disable show the stock (default: true)
diff --git a/web_widget_one2many_product_picker_sale_stock/static/description/index.html b/web_widget_one2many_product_picker_sale_stock/static/description/index.html
index f9246dfdf..f7282d953 100644
--- a/web_widget_one2many_product_picker_sale_stock/static/description/index.html
+++ b/web_widget_one2many_product_picker_sale_stock/static/description/index.html
@@ -391,7 +391,7 @@ ul.auto-toc {
diff --git a/web_widget_one2many_product_picker_sale_stock/static/src/js/views/One2ManyProductPicker/record.js b/web_widget_one2many_product_picker_sale_stock/static/src/js/views/One2ManyProductPicker/record.js
index 52521066d..bc1b6fba3 100644
--- a/web_widget_one2many_product_picker_sale_stock/static/src/js/views/One2ManyProductPicker/record.js
+++ b/web_widget_one2many_product_picker_sale_stock/static/src/js/views/One2ManyProductPicker/record.js
@@ -14,8 +14,31 @@ odoo.define("web_widget_one2many_product_picker_sale_stock.One2ManyProductPicker
*/
_getQWebContext: function () {
var qweb_context = this._super.apply(this, arguments);
- qweb_context["show_sale_stock"] = this.options.showSaleStock;
+ qweb_context.show_sale_stock = this.options.showSaleStock;
return qweb_context;
},
+
+ /**
+ * @override
+ */
+ on_detach_callback: function () {
+ if (!_.isEmpty(this.widgets.front)) {
+ for (var index in this.widgets.front) {
+ var widget = this.widgets.front[index];
+ if (widget.template === 'sale_stock.qtyAtDate') {
+ widget.$el.popover("hide");
+ }
+ }
+ }
+ this._super.apply(this, arguments);
+ },
+
+ /**
+ * @override
+ */
+ destroy: function () {
+ this.on_detach_callback();
+ this._super.apply(this, arguments);
+ },
});
});
diff --git a/web_widget_one2many_product_picker_sale_stock/static/src/js/views/One2ManyProductPicker/renderer.js b/web_widget_one2many_product_picker_sale_stock/static/src/js/views/One2ManyProductPicker/renderer.js
index bd03bfec0..434bab558 100644
--- a/web_widget_one2many_product_picker_sale_stock/static/src/js/views/One2ManyProductPicker/renderer.js
+++ b/web_widget_one2many_product_picker_sale_stock/static/src/js/views/One2ManyProductPicker/renderer.js
@@ -12,7 +12,7 @@ odoo.define("web_widget_one2many_product_picker_sale_stock.One2ManyProductPicker
_getRecordOptions: function (search_record) {
var options = this._super.apply(this, arguments);
options["showSaleStock"] = this.options.show_sale_stock;
- return options
+ return options;
},
});
});
diff --git a/web_widget_one2many_product_picker_sale_stock/static/src/js/widgets/field_one2many_product_picker.js b/web_widget_one2many_product_picker_sale_stock/static/src/js/widgets/field_one2many_product_picker.js
index f1755dca6..a3a9c9109 100644
--- a/web_widget_one2many_product_picker_sale_stock/static/src/js/widgets/field_one2many_product_picker.js
+++ b/web_widget_one2many_product_picker_sale_stock/static/src/js/widgets/field_one2many_product_picker.js
@@ -13,7 +13,7 @@ odoo.define("web_widget_one2many_product_picker_sale_stock.FieldOne2ManyProductP
*/
_getDefaultOptions: function () {
var defaults = this._super.apply(this, arguments);
- defaults["show_sale_stock"] = false;
+ defaults["show_sale_stock"] = true;
return defaults;
},
});
diff --git a/web_widget_one2many_product_picker_sale_stock/static/src/xml/one2many_product_picker.xml b/web_widget_one2many_product_picker_sale_stock/static/src/xml/one2many_product_picker.xml
index f8ae40950..2a99bb91a 100644
--- a/web_widget_one2many_product_picker_sale_stock/static/src/xml/one2many_product_picker.xml
+++ b/web_widget_one2many_product_picker_sale_stock/static/src/xml/one2many_product_picker.xml
@@ -3,7 +3,7 @@
-
+
diff --git a/web_widget_one2many_product_picker_sale_stock/templates/assets.xml b/web_widget_one2many_product_picker_sale_stock/templates/assets.xml
index bda3468c8..84ddd5eb5 100644
--- a/web_widget_one2many_product_picker_sale_stock/templates/assets.xml
+++ b/web_widget_one2many_product_picker_sale_stock/templates/assets.xml
@@ -5,6 +5,9 @@
+
+
+