Commit b1eb6186 by Félicie

Merge branch '3847-pos-click-meal-voucher-if-not-eligible' into 'dev_cooperatic'

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

See merge request !49
parents d53d4aa1 bf2e1e4c
......@@ -262,7 +262,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,7 +278,23 @@ 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();
......@@ -325,14 +340,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