Commit ad281844 by Yvon Kerdoncuff

Revert "Merge branch '4950-scan-in-reception-evolutions-bis' into 'dev_cooperatic'"

This reverts merge request !244
parent 4ceedb8c
Pipeline #3021 failed with stage
in 1 minute 4 seconds
......@@ -100,25 +100,17 @@ function select_product_from_bc(barcode) {
priceToWeightIsCorrect = true;
if (scannedProduct == null) {
alert(
"Article introuvable.\n" +
"Le code barre " + barcode + " n'est associé à aucun article." +
" Mettez ce produit de côté et prévenez un salarié.\n" +
"ATTENTION : A la fin de la réception, ne validez pas tant que ce colis n'a pas été ajouté par le salarié.e."
);
alert("Le code-barre " + barcode + " ne correspond à aucun article connu.");
return -1;
}
var foundProduct = {data: null, place: null};
var qtyOfProcessedProduct = null;
var product_id = null;
// Does the product come from to_process ?
$.each(list_to_process, function(i, e) {
if (e.product_id[0] == scannedProduct.data[barcodes['keys']['id']]) {
foundProduct.data = e;
product_id = e.product_id[0];
foundProduct.place = 'to_process';
}
});
......@@ -128,8 +120,6 @@ function select_product_from_bc(barcode) {
$.each(list_processed, function(i, e) {
if (e.product_id[0] == scannedProduct.data[barcodes['keys']['id']]) {
foundProduct.data = JSON.parse(JSON.stringify(e));
qtyOfProcessedProduct = foundProduct.data.product_qty;
product_id = e.product_id[0];
foundProduct.data.product_qty = null; // Set qty to null from product already scanned
foundProduct.place = 'processed';
}
......@@ -151,32 +141,16 @@ function select_product_from_bc(barcode) {
if (scannedProduct.rule !== 'price_to_weight') {
if (foundProduct.data.product_uom[0] != 21) {
if(foundProduct.place == 'processed') {
//https://redmine.coopdev.fr/issues/4820 specs
foundProduct.data.product_qty = qtyOfProcessedProduct;
alert("Attention, "+qtyOfProcessedProduct+" unités de mesure de ce produit ont déjà été comptées.");
$('#'+product_id+' > td > #processed_line_edit').click();
} else { //place == to_process
$('#'+product_id+' > td > .toProcess_line_edit').click();
}
} else {
if (foundProduct.place === 'to_process') {
let row = table_to_process.row($('#'+foundProduct.data.product_id[0]));
setLineEdition(foundProduct.data);
}
remove_from_toProcess(row, foundProduct.data);
}
// Don't remove product from processed list
if (foundProduct.place === 'to_process') {
let row = table_to_process.row($('#'+foundProduct.data.product_id[0]));
remove_from_toProcess(row, foundProduct.data);
}
// Don't remove product from processed list
}
} else {
//product found in odoo but it's not in this receipt
alert(
"Article trouvé non concerné par cette réception.\n" +
"Le code barre " + barcode + " n'est associé à aucun article de cette réception." +
" Mettez ce produit de côté et prévenez un salarié.\n" +
"ATTENTION : A la fin de la réception, ne validez pas tant que ce colis n'a pas été ajouté par le salarié.e"
);
return -1;
}
}
} catch (e) {
......@@ -400,11 +374,6 @@ function fetch_data(po_ids = null) {
// Load barcodes at page loading, then barcodes are stored locally
var get_barcodes = async function() {
if (barcodes == null) barcodes = await init_barcodes();
//A partial test of https://redmine.coopdev.fr/issues/4950 without scanner : choose barcode and uncomment following line.
//If you paste this line in the console, the focus().select() will not work, but it will work in real conditions
//select_product_from_bc("0493408000008");
//select_product_from_bc("0490010008521");
//select_product_from_bc("0490010008651");
};
// Get labels to print for current orders from server
......@@ -848,7 +817,6 @@ function initLists() {
$('table.dataTable').DataTable()
.search('')
.draw();
$("#edition_input").focus().select();
}
} catch (e) {
err = {msg: e.name + ' : ' + e.message, ctx: 'initLists : listener edit line from list to process'};
......@@ -906,7 +874,6 @@ function initLists() {
$('table.dataTable').DataTable()
.search('')
.draw();
$("#edition_input").focus().select();
}
} catch (e) {
err = {
......
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