[IMP] point_of_sale,pos_mercury: do not save pending payments
It is by default in pos_mercury that pending payments are removed before syncing the order to the backend. However, this is not the case for the newly introduced API for payment terminals in pos. In this commit, we are implementing this pos_mercury feature as default for all terminal payment methods. closes odoo/odoo#35579 Task-id: 1984690 Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
This commit is contained in:
@@ -2436,6 +2436,14 @@ var PaymentScreenWidget = ScreenWidget.extend({
|
||||
// and complete the sale process
|
||||
validate_order: function(force_validation) {
|
||||
if (this.order_is_valid(force_validation)) {
|
||||
// remove pending payments before finalizing the validation
|
||||
var order = this.pos.get_order();
|
||||
order.get_paymentlines().forEach(line => {
|
||||
if (!line.is_done()) {
|
||||
order.remove_paymentline(line);
|
||||
}
|
||||
});
|
||||
this.render_paymentlines();
|
||||
this.finalize_validation();
|
||||
}
|
||||
},
|
||||
|
||||
@@ -642,23 +642,6 @@ PaymentScreenWidget.include({
|
||||
this.pos.barcode_reader.set_action_callback('credit', _.bind(this.credit_code_action, this));
|
||||
}
|
||||
},
|
||||
|
||||
// before validating, get rid of any paymentlines that are waiting
|
||||
// on a swipe.
|
||||
validate_order: function(force_validation) {
|
||||
if (this.pos.get_order().is_paid() && ! this.invoicing) {
|
||||
var lines = this.pos.get_order().get_paymentlines();
|
||||
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
if (lines[i].mercury_swipe_pending) {
|
||||
this.pos.get_order().remove_paymentline(lines[i]);
|
||||
this.render_paymentlines();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this._super(force_validation);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user