Commit c64229fe by Damien Moulard

display error message if selecting meal voucher payment method and no amount eligible

parent fd231727
......@@ -249,6 +249,15 @@ odoo.define("pos_meal_voucher.screens", function (require) {
},
click_paymentmethods_meal_voucher_mixed: function(id) {
var order = this.pos.get_order();
if (order.get_total_meal_voucher_eligible() == 0) {
this.gui.show_popup("alert", {
'title': _t("Meal Voucher 0 amount"),
'body': _t("can't pay"),
});
return false;
}
var cashregister = null;
for ( var i = 0; i < this.pos.cashregisters.length; i++ ) {
if ( this.pos.cashregisters[i].journal_id[0] === id ){
......@@ -262,7 +271,6 @@ odoo.define("pos_meal_voucher.screens", function (require) {
this.reset_input();
this.render_paymentlines();
},
render_paymentmethods: function() {
var self = this;
var methods = this._super.apply(this, arguments);
......@@ -279,8 +287,24 @@ odoo.define("pos_meal_voucher.screens", function (require) {
var paymentScreen = this.pos.gui.current_screen;
var order = this.pos.get_order();
if (
order.selected_paymentline.is_meal_voucher()
&& order.get_total_meal_voucher_eligible() == 0
) {
this.gui.show_popup("alert", {
'title': _t("Impossible de payer en titre restaurant"),
'body': _t("Aucun article du panier n'est éligible en titres restaurants (Montant éligible : 0€)."),
cancel: function() {
this.pos.get_order().remove_paymentline(order.selected_paymentline);
var paymentScreen = this.pos.gui.current_screen;
paymentScreen.reset_input();
paymentScreen.render_paymentlines();
}
});
return false;
}
if(order.selected_paymentline.is_meal_voucher() && order.selected_paymentline.is_dematerialized_meal_voucher()){
var total_eligible = order.get_total_meal_voucher_eligible();
var total_received = order.get_total_meal_voucher_received();
......@@ -325,14 +349,8 @@ odoo.define("pos_meal_voucher.screens", function (require) {
},
});
}
},
render_paymentlines: function() {
var self = this;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment