summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorJoseph Caburnay <jcb@odoo.com>2019-10-31 12:06:20 +0000
committerJoseph Caburnay <jcb@odoo.com>2019-10-31 12:16:29 +0000
commit455ac6b305f29bcdf446b7b0845d98baacc85fc9 (patch)
tree2461ffcf744fc4f677cfdf513687ec57837fd06d /addons
parent7d3dfeb4738149b154791efc8e5adfe9fe79a05e (diff)
[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>
Diffstat (limited to 'addons')
-rw-r--r--addons/point_of_sale/static/src/js/screens.js8
-rw-r--r--addons/pos_mercury/static/src/js/pos_mercury.js17
2 files changed, 8 insertions, 17 deletions
diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js
index 95d96ae3726..d7982b538ed 100644
--- a/addons/point_of_sale/static/src/js/screens.js
+++ b/addons/point_of_sale/static/src/js/screens.js
@@ -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();
}
},
diff --git a/addons/pos_mercury/static/src/js/pos_mercury.js b/addons/pos_mercury/static/src/js/pos_mercury.js
index 70e9db8f3d2..d5663b38d57 100644
--- a/addons/pos_mercury/static/src/js/pos_mercury.js
+++ b/addons/pos_mercury/static/src/js/pos_mercury.js
@@ -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);
- }
});
});