From b213c9ee3c8204fef2ddb4c377c59d7e3c6a0464 Mon Sep 17 00:00:00 2001 From: Pierre Masereel Date: Tue, 17 Sep 2019 07:02:51 +0000 Subject: [PATCH] [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 --- addons/point_of_sale/static/src/xml/pos.xml | 2 +- .../pos_restaurant/static/src/js/printbill.js | 31 ++-- .../static/src/xml/printbill.xml | 133 +----------------- 3 files changed, 19 insertions(+), 147 deletions(-) diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml index d693c3f15cb..3a6353991ab 100644 --- a/addons/point_of_sale/static/src/xml/pos.xml +++ b/addons/point_of_sale/static/src/xml/pos.xml @@ -1003,7 +1003,7 @@
-
+
CHANGE
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, -} +}; }); diff --git a/addons/pos_restaurant/static/src/xml/printbill.xml b/addons/pos_restaurant/static/src/xml/printbill.xml index 3e64f249bf3..47fe78fd44f 100644 --- a/addons/pos_restaurant/static/src/xml/printbill.xml +++ b/addons/pos_restaurant/static/src/xml/printbill.xml @@ -33,135 +33,12 @@ - -
- - -
+ + + +
PRO FORMA
- -

- -

-
-
-
- -
-
- -
Tel:
-
- -
:
-
- -
-
- -
-
- -
-
- -
-
--------------------------------
-
Served by
-
-
-
-

- - - -
- - - -
- - -
-
- -
- -
Discount: %
-
-
- - - - - x - - -
-
-
-
- - - - -
--------
-
-
Subtotal
- -
- - -
-
-
- - - -
--------
-
-
- TOTAL - -
-

- - - - -
- Discounts - -
-
- - -
- - -
-
-
- - - - - - - -
- -
-
-
- -
-
-
-
-
- -
+