[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
This commit is contained in:
Antoine Prieels
2019-08-12 08:16:04 +02:00
parent dc449a4ae5
commit 187eb053d6
2 changed files with 12 additions and 9 deletions
@@ -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);
@@ -13,13 +13,13 @@
attrs="{'invisible' : ['|', ('cash_control', '=', False), ('state', '!=', 'opening_control')]}" class="oe_highlight"/>
<button name="open_frontend_cb" type="object" string="Continue Selling" states="opened"
class="oe_highlight"/>
<button name="action_pos_session_closing_control" type="object" string="End of Session"
<button id="end_session_opened" name="action_pos_session_closing_control" type="object" string="End of Session"
attrs="{'invisible' : ['|', ('cash_control', '=', False),('state', '!=', 'opened')]}"
class="oe_highlight"/>
<button name="action_pos_session_closing_control" type="object" string="Validate Closing &amp; Post Entries"
<button id="validate_opened" name="action_pos_session_closing_control" type="object" string="Validate Closing &amp; Post Entries"
attrs="{'invisible' : ['|', ('cash_control', '=', True),('state', '!=', 'opened')]}"
class="oe_highlight"/>
<button name="action_pos_session_validate" type="object" string="Validate Closing &amp; Post Entries" states="closing_control"
<button id="validate_closing_control" name="action_pos_session_validate" type="object" string="Validate Closing &amp; Post Entries" states="closing_control"
class="oe_highlight"/>
<field name="state" widget="statusbar" statusbar_visible="new_session,opening_control,opened,closing_control,closed" nolabel="1" />