From 187eb053d6ca7e4d28459940e0f68bb11e88cdc4 Mon Sep 17 00:00:00 2001 From: Antoine Prieels Date: Thu, 23 May 2019 09:41:16 +0200 Subject: [PATCH] [IMP] point_of_sale: Six terminal interface Small changes to prepare the modifications needed by the interface of Six terminals in Enterprise: - With the possibility of reversing payments, we could possibly have payment lines that have an amount of 0. The computation of the 'extradue' will be wrong in this case and we need to put it in a separate function so that we can override it in pos_iot. - Add ids to "Validate Closing & Post Entries" buttons to override them to send balance on close. TaskId: 1932416 --- addons/point_of_sale/static/src/js/screens.js | 15 +++++++++------ addons/point_of_sale/views/pos_session_view.xml | 6 +++--- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index fc9649129ab..48dbfd28b90 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -1945,12 +1945,7 @@ var PaymentScreenWidget = ScreenWidget.extend({ } var lines = order.get_paymentlines(); - var due = order.get_due(); - var extradue = 0; - if (due && lines.length && due !== order.get_due(lines[lines.length-1])) { - extradue = due; - } - + var extradue = this.compute_extradue(order); this.$('.paymentlines-container').empty(); var lines = $(QWeb.render('PaymentScreen-Paymentlines', { @@ -1970,6 +1965,14 @@ var PaymentScreenWidget = ScreenWidget.extend({ lines.appendTo(this.$('.paymentlines-container')); }, + compute_extradue: function (order) { + var lines = order.get_paymentlines(); + var due = order.get_due(); + if (due && lines.length && due !== order.get_due(lines[lines.length-1])) { + return due; + } + return 0; + }, click_paymentmethods: function(id) { var payment_method = this.pos.payment_methods_by_id[id] this.pos.get_order().add_paymentline(payment_method); diff --git a/addons/point_of_sale/views/pos_session_view.xml b/addons/point_of_sale/views/pos_session_view.xml index 2ef12e16b2e..afc0cab74d6 100644 --- a/addons/point_of_sale/views/pos_session_view.xml +++ b/addons/point_of_sale/views/pos_session_view.xml @@ -13,13 +13,13 @@ attrs="{'invisible' : ['|', ('cash_control', '=', False), ('state', '!=', 'opening_control')]}" class="oe_highlight"/>