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) { ...@@ -100,25 +100,17 @@ function select_product_from_bc(barcode) {
priceToWeightIsCorrect = true; priceToWeightIsCorrect = true;
if (scannedProduct == null) { if (scannedProduct == null) {
alert( alert("Le code-barre " + barcode + " ne correspond à aucun article connu.");
"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."
);
return -1; return -1;
} }
var foundProduct = {data: null, place: null}; var foundProduct = {data: null, place: null};
var qtyOfProcessedProduct = null;
var product_id = null;
// Does the product come from to_process ? // Does the product come from to_process ?
$.each(list_to_process, function(i, e) { $.each(list_to_process, function(i, e) {
if (e.product_id[0] == scannedProduct.data[barcodes['keys']['id']]) { if (e.product_id[0] == scannedProduct.data[barcodes['keys']['id']]) {
foundProduct.data = e; foundProduct.data = e;
product_id = e.product_id[0];
foundProduct.place = 'to_process'; foundProduct.place = 'to_process';
} }
}); });
...@@ -128,8 +120,6 @@ function select_product_from_bc(barcode) { ...@@ -128,8 +120,6 @@ function select_product_from_bc(barcode) {
$.each(list_processed, function(i, e) { $.each(list_processed, function(i, e) {
if (e.product_id[0] == scannedProduct.data[barcodes['keys']['id']]) { if (e.product_id[0] == scannedProduct.data[barcodes['keys']['id']]) {
foundProduct.data = JSON.parse(JSON.stringify(e)); 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.data.product_qty = null; // Set qty to null from product already scanned
foundProduct.place = 'processed'; foundProduct.place = 'processed';
} }
...@@ -151,15 +141,9 @@ function select_product_from_bc(barcode) { ...@@ -151,15 +141,9 @@ function select_product_from_bc(barcode) {
if (scannedProduct.rule !== 'price_to_weight') { if (scannedProduct.rule !== 'price_to_weight') {
if (foundProduct.data.product_uom[0] != 21) { if (foundProduct.data.product_uom[0] != 21) {
if(foundProduct.place == 'processed') { setLineEdition(foundProduct.data);
//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') { if (foundProduct.place === 'to_process') {
let row = table_to_process.row($('#'+foundProduct.data.product_id[0])); let row = table_to_process.row($('#'+foundProduct.data.product_id[0]));
...@@ -168,16 +152,6 @@ function select_product_from_bc(barcode) { ...@@ -168,16 +152,6 @@ function select_product_from_bc(barcode) {
// Don't remove product from processed list // 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) { } catch (e) {
err = {msg: e.name + ' : ' + e.message, ctx: 'select_product_from_bc'}; err = {msg: e.name + ' : ' + e.message, ctx: 'select_product_from_bc'};
...@@ -400,11 +374,6 @@ function fetch_data(po_ids = null) { ...@@ -400,11 +374,6 @@ function fetch_data(po_ids = null) {
// Load barcodes at page loading, then barcodes are stored locally // Load barcodes at page loading, then barcodes are stored locally
var get_barcodes = async function() { var get_barcodes = async function() {
if (barcodes == null) barcodes = await init_barcodes(); 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 // Get labels to print for current orders from server
...@@ -848,7 +817,6 @@ function initLists() { ...@@ -848,7 +817,6 @@ function initLists() {
$('table.dataTable').DataTable() $('table.dataTable').DataTable()
.search('') .search('')
.draw(); .draw();
$("#edition_input").focus().select();
} }
} catch (e) { } catch (e) {
err = {msg: e.name + ' : ' + e.message, ctx: 'initLists : listener edit line from list to process'}; err = {msg: e.name + ' : ' + e.message, ctx: 'initLists : listener edit line from list to process'};
...@@ -906,7 +874,6 @@ function initLists() { ...@@ -906,7 +874,6 @@ function initLists() {
$('table.dataTable').DataTable() $('table.dataTable').DataTable()
.search('') .search('')
.draw(); .draw();
$("#edition_input").focus().select();
} }
} catch (e) { } catch (e) {
err = { 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