Merge PR #1896 into 12.0

Signed-off-by pedrobaeza
pull/1836/head
OCA-git-bot 2021-04-09 09:39:13 +00:00
commit 40c3d54339
8 changed files with 33 additions and 7 deletions

View File

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

View File

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

View File

@ -391,7 +391,7 @@ ul.auto-toc {
<div class="section" id="widget-options">
<h2><a class="toc-backref" href="#id2">Widget options:</a></h2>
<ul class="simple">
<li>show_sale_stock &gt; Enable/Disable show the stock</li>
<li>show_sale_stock &gt; Enable/Disable show the stock (default: true)</li>
</ul>
</div>
</div>

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
<t t-extend="One2ManyProductPicker.FlipCard">
<t t-jquery="div[t-attf-class*=oe_flip_card_front] t[t-if='state']" t-operation="append">
<t t-if="state.model === 'sale.order.line'">
<t t-if="show_sale_stock &amp;&amp; state.model === 'sale.order.line'">
<div class="position-absolute m-0 text-left stock_info">
<widget name="qty_at_date_widget" width="0.1"/>
</div>

View File

@ -5,6 +5,9 @@
<link type="text/css" rel="stylesheet"
href="/web_widget_one2many_product_picker_sale_stock/static/src/scss/one2many_product_picker.scss"/>
<script type="text/javascript" src="/web_widget_one2many_product_picker_sale_stock/static/src/js/views/abstract_view.js"></script>
<script type="text/javascript" src="/web_widget_one2many_product_picker_sale_stock/static/src/js/widgets/field_one2many_product_picker.js"></script>
<script type="text/javascript" src="/web_widget_one2many_product_picker_sale_stock/static/src/js/views/One2ManyProductPicker/record.js"></script>
<script type="text/javascript" src="/web_widget_one2many_product_picker_sale_stock/static/src/js/views/One2ManyProductPicker/renderer.js"></script>
</xpath>
</template>
</odoo>