Commit 7d950b93 by François C.

Improve user experience after click 'print product labels'

parent 6417e7e9
Pipeline #2483 passed with stage
in 1 minute 24 seconds
...@@ -91,6 +91,8 @@ class CagetteProduct(models.Model): ...@@ -91,6 +91,8 @@ class CagetteProduct(models.Model):
v = round(float(price) / float(product['weight_net']), 2) v = round(float(price) / float(product['weight_net']), 2)
if k == 'price_volume' and len(v) > 0 and len(price) > 0 and float(price) > 0: if k == 'price_volume' and len(v) > 0 and len(price) > 0 and float(price) > 0:
v = round(float(price) / float(product['volume']), 2) v = round(float(price) / float(product['volume']), 2)
if directory != "/product_labels/" or (directory == "/product_labels/" and k != "meal_voucher_ok"):
# add parameter to text unless it's for a product label and parameter is meal_voucher_ok
txt += k + '=' + str(v).strip() + "\r\n" txt += k + '=' + str(v).strip() + "\r\n"
if not (nb is None) and len(nb) > 0: if not (nb is None) and len(nb) > 0:
txt += 'nb_impression=' + str(nb) + "\r\n" txt += 'nb_impression=' + str(nb) + "\r\n"
......
...@@ -1484,8 +1484,19 @@ function print_product_labels() { ...@@ -1484,8 +1484,19 @@ function print_product_labels() {
try { try {
if (is_time_to('print_pdt_labels', 10000)) { if (is_time_to('print_pdt_labels', 10000)) {
$.ajax("../../orders/print_product_labels?oids=" + group_ids.join(',')) $.ajax("../../orders/print_product_labels?oids=" + group_ids.join(','))
.done(function() { .done(function(data) {
alert('Impression des étiquettes à coller sur les articles lancée.'); let success = false;
if (typeof data.res !== "undefined") {
if (typeof data.res.error === "undefined") {
success = true;
}
}
if (success == true) {
alert("l' impression des étiquettes à coller sur les articles vient d'être lancée.");
$('#barcodesToPrint').hide();
} else {
alert("Une erreur est survenue.")
}
}); });
} else { } else {
alert("Vous avez cliqué il y a moins de 10s... Patience, la demande est en cours de traitement."); alert("Vous avez cliqué il y a moins de 10s... Patience, la demande est en cours de traitement.");
......
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