Commit bc64ef6d by François C.

Correctifs reception_index.js suite erreur affichage bouton 'commandes groupées'

parent b83db634
Pipeline #1228 passed with stage
in 1 minute 25 seconds
...@@ -287,7 +287,7 @@ function group_action() { ...@@ -287,7 +287,7 @@ function group_action() {
function display_grouped_orders() { function display_grouped_orders() {
if (table_orders !== null) { if (table_orders !== null) {
var display_something = true; var display_something = false;
$('#groups_items').empty(); $('#groups_items').empty();
let groups_display_content = "<ul>"; let groups_display_content = "<ul>";
...@@ -310,8 +310,10 @@ function display_grouped_orders() { ...@@ -310,8 +310,10 @@ function display_grouped_orders() {
} }
} }
} }
if (group_orders.length > 0) { if (group_orders.length > 0) {
// Display group // Display group
display_something = true;
document.getElementById("container_groups").hidden = false; document.getElementById("container_groups").hidden = false;
let group_row = `<li class="group_line"> Commandes de `; let group_row = `<li class="group_line"> Commandes de `;
...@@ -335,8 +337,6 @@ function display_grouped_orders() { ...@@ -335,8 +337,6 @@ function display_grouped_orders() {
group_row += "</li>"; group_row += "</li>";
groups_display_content += group_row; groups_display_content += group_row;
} else {
display_something = false; // occured making test form local django and preprod (couchdb, odoo)
} }
} }
if (display_something === true) { if (display_something === true) {
...@@ -354,7 +354,9 @@ function display_orders_table() { ...@@ -354,7 +354,9 @@ function display_orders_table() {
table_orders.clear().destroy(); table_orders.clear().destroy();
$('#orders').empty(); $('#orders').empty();
} }
for (let j in orders) {
console.log(orders[j].id)
}
table_orders = $('#orders').DataTable({ table_orders = $('#orders').DataTable({
data: orders, data: orders,
columns:[ columns:[
......
...@@ -305,6 +305,8 @@ def save_error_report(request): ...@@ -305,6 +305,8 @@ def save_error_report(request):
} }
data['orders'].append(group_order) data['orders'].append(group_order)
else:
coop_logger.info("data['orders'] is a single PO (not inside group)")
except Exception as e2: except Exception as e2:
coop_logger.error("Save reception report : Error while create group_order %s", str(e2)) coop_logger.error("Save reception report : Error while create group_order %s", str(e2))
...@@ -457,6 +459,8 @@ def save_error_report(request): ...@@ -457,6 +459,8 @@ def save_error_report(request):
error_total_abs += abs(item['error_line']) error_total_abs += abs(item['error_line'])
data_full.append(item) data_full.append(item)
else:
coop_logger.info("Save reception error doc : no 'updated_products' in order (%s)", str(order))
except Exception as e5: except Exception as e5:
coop_logger.error("Save reception report : Error while updating products %s", str(e5)) coop_logger.error("Save reception report : Error while updating products %s", str(e5))
# no updated products, do nothing # no updated products, do nothing
...@@ -592,9 +596,12 @@ def save_error_report(request): ...@@ -592,9 +596,12 @@ def save_error_report(request):
else: else:
m = CagetteReception(order['id']) m = CagetteReception(order['id'])
m.attach_file(fileName) m.attach_file(fileName)
coop_logger.info("%s attached to order id %s", fileName, str(order['id']))
except Exception as e8: except Exception as e8:
coop_logger.error("PO save report Error while saving file %s (%s)", fileName, str(e8)) coop_logger.error("PO save report Error while saving file %s (%s)", fileName, str(e8))
else: else:
coop_logger.error("Save reception error report : unknown state %s (%s) ", str(data['update_type']), str(data))
else:
coop_logger.error("Cant find 'orders' in data (%s)", str(data)) coop_logger.error("Cant find 'orders' in data (%s)", str(data))
else: else:
coop_logger.info("Was waiting for a POST method (%s)", str(request.method)) coop_logger.info("Was waiting for a POST method (%s)", str(request.method))
......
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