diff options
| author | Julien Mougenot <jum@odoo.com> | 2020-03-11 09:38:29 +0000 |
|---|---|---|
| committer | Julien Mougenot <jum@odoo.com> | 2020-03-13 14:08:33 +0000 |
| commit | e68d3bb09d1f844387ceb20aa76022ace48507d9 (patch) | |
| tree | d238fa35dcb11e5628112377a9daf569405ca74b /addons/product/static | |
| parent | 18e5416636b19b0953b1e6e26bfaeab1ebecce4c (diff) | |
[REF] *: Adapt all modules to new control panel
Adaptation of the code throughout all modules to properly instantiate the newly
refactored control panel and update it accordingly.
Part of task 2196029
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Diffstat (limited to 'addons/product/static')
| -rw-r--r-- | addons/product/static/src/js/product_pricelist_report.js | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/addons/product/static/src/js/product_pricelist_report.js b/addons/product/static/src/js/product_pricelist_report.js index 5c437f07498..fa19e0c8a3a 100644 --- a/addons/product/static/src/js/product_pricelist_report.js +++ b/addons/product/static/src/js/product_pricelist_report.js @@ -30,7 +30,7 @@ var QtyTagWidget = Widget.extend({ /** * Add a quantity when add(+) button clicked. - * + * * @private */ _onClickAddQty: function () { @@ -143,9 +143,8 @@ var GeneratePriceList = AbstractAction.extend(StandaloneFieldManagerMixin, { * @override */ start: function () { + this.controlPanelProps.cp_content = this._renderComponent(); return this._super.apply(this, arguments).then(() => { - this._renderComponent(); - this.update_cp(); this.$('.o_content').html(this.reportHtml); }); }, @@ -164,22 +163,6 @@ var GeneratePriceList = AbstractAction.extend(StandaloneFieldManagerMixin, { }, //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - /** - * @override - */ - update_cp: function () { - this.updateControlPanel({ - cp_content: { - $buttons: this.$buttonPrint, - $searchview_buttons: this.$searchView, - }, - }); - }, - - //-------------------------------------------------------------------------- // Private //-------------------------------------------------------------------------- @@ -215,16 +198,17 @@ var GeneratePriceList = AbstractAction.extend(StandaloneFieldManagerMixin, { * @private */ _renderComponent: function () { - this.$buttonPrint = $('<button>', { + const $buttons = $('<button>', { class: 'btn btn-primary', text: _t("Print"), }).on('click', this._onClickPrint.bind(this)); - this.$searchView = $(QWeb.render('product.report_pricelist_search')); - this.many2one.appendTo(this.$searchView.find('.o_pricelist')); + const $searchview = $(QWeb.render('product.report_pricelist_search')); + this.many2one.appendTo($searchview.find('.o_pricelist')); this.qtyTagWidget = new QtyTagWidget(this, this.context.quantities); - this.qtyTagWidget.replace(this.$searchView.find('.o_product_qty')); + this.qtyTagWidget.replace($searchview.find('.o_product_qty')); + return { $buttons, $searchview }; }, //-------------------------------------------------------------------------- |
