Commit a92202da by Yvon

fix check making sure that paper meal voucher amount is not bigger than…

fix check making sure that paper meal voucher amount is not bigger than remaining due ; cleaning : set default amount to zero for paper meal voucher paiement line created before barcode popup is validated
parent b16de136
......@@ -33,7 +33,9 @@ odoo.define("pos_meal_voucher.screens", function (require) {
let order_due = order.get_due();
// Display info popup if amount is too high
if (total_received > order_due) {
// bug fix below : as order_due deduces previous paiement lines from initial due,
// it must be compared to amount of current line only and not to total_received
if (/*total_received*/amount > order_due) {
this.gui.show_popup("alert", {
'title': _t("Impossible d'utiliser ce Titre Restaurant"),
'body': _t("Vous ne pouvez pas ajouter ce ticket restaurant car le montant total est supérieur au montant restant dû de la commande")
......@@ -406,6 +408,12 @@ odoo.define("pos_meal_voucher.screens", function (require) {
// If user choose paper meal voucher
// Open a popup asking for the number of the meal voucher
if(order.selected_paymentline.is_meal_voucher() && order.selected_paymentline.is_paper_meal_voucher()){
// Maybe not needed but cleaner : Set selected payment line amount to 0 before any further check
order.selected_paymentline.set_amount(0);
paymentScreen.order_changes();
paymentScreen.render_paymentlines();
paymentScreen.$(".paymentline.selected .edit").text(paymentScreen.format_currency_no_symbol(0));
this.gui.show_popup("textinput", {
'title': _t("Chèque Restaurant"),
'body': _t("Pour ajouter un chèque restaurant, merci de scanner le code barre du chèque. Si le chèque est illisible, veuillez rentrer le code à la main."),
......
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