diff options
| author | Pierre Masereel <pim@odoo.com> | 2019-09-17 07:02:51 +0000 |
|---|---|---|
| committer | Pierre Masereel <pim@odoo.com> | 2019-10-01 10:02:49 +0000 |
| commit | b213c9ee3c8204fef2ddb4c377c59d7e3c6a0464 (patch) | |
| tree | 6da43dfa9e2b02063d57fcccd77ae85d9316d35f /addons/pos_restaurant/static/src/js | |
| parent | 69dc97c6986dbe363ed8c9cd1934cfd56cee8814 (diff) | |
[FIX] point_of_sale, pos_restaurant: print bill with correct template
Until now, the ticket printed from the web or to the printer were
different because one was using the OrderReceipt template and removed
some fields, and the other was using the BillReceipt.
We are now using only the bill receipt, to avoid to maintain multiple
template showing the same thing.
TASK-ID: 47990
Diffstat (limited to 'addons/pos_restaurant/static/src/js')
| -rw-r--r-- | addons/pos_restaurant/static/src/js/printbill.js | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/addons/pos_restaurant/static/src/js/printbill.js b/addons/pos_restaurant/static/src/js/printbill.js index 233e25c757f..88966c72ec1 100644 --- a/addons/pos_restaurant/static/src/js/printbill.js +++ b/addons/pos_restaurant/static/src/js/printbill.js @@ -15,35 +15,30 @@ var BillScreenWidget = screens.ReceiptScreenWidget.extend({ click_back: function(){ this.gui.show_screen('products'); }, + get_receipt_render_env: function(){ + var render_env = this._super(); + render_env.receipt.bill = true; + return render_env; + }, render_receipt: function(){ this._super(); - this.$('.receipt-paymentlines').remove(); this.$('.receipt-change').remove(); }, - print_web: function(){ - window.print(); - }, }); gui.define_screen({name:'bill', widget: BillScreenWidget}); var PrintBillButton = screens.ActionButtonWidget.extend({ template: 'PrintBillButton', - print_html: function(){ - var order = this.pos.get('selectedOrder'); - if(order.get_orderlines().length > 0){ - var receipt = order.export_for_printing(); - receipt.bill = true; - this.pos.proxy.printer.print_receipt(QWeb.render('BillReceipt',{ - receipt: receipt, widget: this, pos: this.pos, order: order, - })); - } - }, button_click: function(){ - if (!this.pos.config.iface_print_via_proxy) { + var order = this.pos.get('selectedOrder'); + if(order.get_orderlines().length > 0) { this.gui.show_screen('bill'); } else { - this.print_html(); + this.gui.show_popup('error', { + 'title': _t('Nothing to Print'), + 'body': _t('There is no order lines'), + }); } }, }); @@ -51,12 +46,12 @@ var PrintBillButton = screens.ActionButtonWidget.extend({ screens.define_action_button({ 'name': 'print_bill', 'widget': PrintBillButton, - 'condition': function(){ + 'condition': function(){ return this.pos.config.iface_printbill; }, }); return { BillScreenWidget: BillScreenWidget, PrintBillButton: PrintBillButton, -} +}; }); |
