diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index a89f4db5e98..661e5e18b0f 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -1394,6 +1394,10 @@ var ReceiptScreenWidget = ScreenWidget.extend({ click_next: function() { this.pos.get_order().finalize(); }, + click_back: function() { + // Placeholder method for ReceiptScreen extensions that + // can go back ... + }, renderElement: function() { var self = this; this._super(); @@ -1402,6 +1406,11 @@ var ReceiptScreenWidget = ScreenWidget.extend({ self.click_next(); } }); + this.$('.back').click(function(){ + if (!self._locked) { + self.click_back(); + } + }); this.$('.button.print').click(function(){ if (!self._locked) { self.print(); @@ -1825,6 +1834,7 @@ var PaymentScreenWidget = ScreenWidget.extend({ gui.define_screen({name:'payment', widget: PaymentScreenWidget}); return { + ReceiptScreenWidget: ReceiptScreenWidget, ActionButtonWidget: ActionButtonWidget, define_action_button: define_action_button, ScreenWidget: ScreenWidget, diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml index 0b2364d0c2e..98dc3e464d5 100644 --- a/addons/point_of_sale/static/src/xml/pos.xml +++ b/addons/point_of_sale/static/src/xml/pos.xml @@ -1250,7 +1250,7 @@
- +
@@ -1274,7 +1274,7 @@

- +
Subtotal: @@ -1303,7 +1303,7 @@

- +
@@ -1314,7 +1314,7 @@

- +
diff --git a/addons/pos_restaurant/static/src/js/printbill.js b/addons/pos_restaurant/static/src/js/printbill.js index 3c9cacdda91..578fd250403 100644 --- a/addons/pos_restaurant/static/src/js/printbill.js +++ b/addons/pos_restaurant/static/src/js/printbill.js @@ -3,12 +3,33 @@ odoo.define('pos_restaurant.printbill', function (require) { var core = require('web.core'); var screens = require('point_of_sale.screens'); +var gui = require('point_of_sale.gui'); var QWeb = core.qweb; +var BillScreenWidget = screens.ReceiptScreenWidget.extend({ + template: 'BillScreenWidget', + click_next: function(){ + this.gui.show_screen('products'); + }, + click_back: function(){ + this.gui.show_screen('products'); + }, + 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', - button_click: function(){ + print_xml: function(){ var order = this.pos.get('selectedOrder'); if(order.get_orderlines().length > 0){ var receipt = order.export_for_printing(); @@ -18,6 +39,13 @@ var PrintBillButton = screens.ActionButtonWidget.extend({ })); } }, + button_click: function(){ + if (!this.pos.config.iface_print_via_proxy) { + this.gui.show_screen('bill'); + } else { + this.print_xml(); + } + }, }); screens.define_action_button({ diff --git a/addons/pos_restaurant/static/src/xml/printbill.xml b/addons/pos_restaurant/static/src/xml/printbill.xml index 7bceefb05e6..79c82ea95b2 100644 --- a/addons/pos_restaurant/static/src/xml/printbill.xml +++ b/addons/pos_restaurant/static/src/xml/printbill.xml @@ -1,6 +1,31 @@ + +
+
+
+ + + Back + +

Bill Printing

+ + Ok + + +
+
+
+ Print +
+
+
+
+
+
+
+
Change: