[FIX] point_of_sale: prevent negative bank payments
This commit is contained in:
parent
681c33aa11
commit
4647f896a4
|
@ -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(){
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue