diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index 5136a6352a2..b768633f296 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -2191,6 +2191,14 @@ exports.Paymentline = Backbone.Model.extend({ this.trigger('change', this); }, + /** + * Check if paymentline is done. + * Paymentline is done if there is no payment status or the payment status is done. + */ + is_done: function() { + return this.get_payment_status() ? this.get_payment_status() === 'done' : true; + }, + /** * Set additional info to be printed on the receipts. value should * be compatible with both the QWeb and ESC/POS receipts. @@ -2862,11 +2870,7 @@ exports.Order = Backbone.Model.extend({ }, get_total_paid: function() { return round_pr(this.paymentlines.reduce((function(sum, paymentLine) { - if (paymentLine.get_payment_status()) { - if (paymentLine.get_payment_status() == 'done') { - sum += paymentLine.get_amount(); - } - } else { + if (paymentLine.is_done()) { sum += paymentLine.get_amount(); } return sum; diff --git a/addons/pos_mercury/static/src/js/pos_mercury.js b/addons/pos_mercury/static/src/js/pos_mercury.js index 59e57b22ad8..8a1e56e9ac2 100644 --- a/addons/pos_mercury/static/src/js/pos_mercury.js +++ b/addons/pos_mercury/static/src/js/pos_mercury.js @@ -125,6 +125,10 @@ pos_model.Paymentline = pos_model.Paymentline.extend({ if (this.mercury_card_number) { this.name = this.mercury_card_brand + " (****" + this.mercury_card_number + ")"; } + }, + is_done: function () { + var res = _paylineproto.is_done.apply(this); + return res && !this.mercury_swipe_pending; } });