diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index 63789cf5625..a7507d5629f 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -938,6 +938,10 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal this.trigger('change:selected',this); } }, + // returns the payment type: 'cash' | 'bank' + get_type: function(){ + return this.cashregister.journal.type + }, // returns the associated cashregister //exports as JSON for server communication export_as_JSON: function(){ diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index ed7110ceb14..5579d20f7c5 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -1263,6 +1263,17 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa return; } + var plines = currentOrder.get('paymentLines').models; + for (var i = 0; i < plines.length; i++) { + if (plines[i].get_type() === 'bank' && plines[i].get_amount() < 0) { + this.pos_widget.screen_selector.show_popup('error',{ + 'message': _t('Negative Bank Payment'), + 'comment': _t('You cannot have a negative amount in a Bank payment. Use a cash payment method to return money to the customer.'), + }); + return; + } + } + if(!this.is_paid()){ return; }