Commit d6c224a6 by Administrator

Merge branch '5555-CAGETTE-bug-blocage-deuxieme-paiement-dej' into 'dev_cooperatic'

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

See merge request !70
parents b16de136 a92202da
...@@ -33,7 +33,9 @@ odoo.define("pos_meal_voucher.screens", function (require) { ...@@ -33,7 +33,9 @@ odoo.define("pos_meal_voucher.screens", function (require) {
let order_due = order.get_due(); let order_due = order.get_due();
// Display info popup if amount is too high // 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", { this.gui.show_popup("alert", {
'title': _t("Impossible d'utiliser ce Titre Restaurant"), '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") '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) { ...@@ -406,6 +408,12 @@ odoo.define("pos_meal_voucher.screens", function (require) {
// If user choose paper meal voucher // If user choose paper meal voucher
// Open a popup asking for the number of the 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()){ 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", { this.gui.show_popup("textinput", {
'title': _t("Chèque Restaurant"), '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."), '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