Commit b7186bd6 by Alexis Aoun

feat: lors d'un scan le poids est automatiquement detecte

Lorsque l'on scan un produit dont la quantite est en poids, celui ci est automatiquement affecte a l'input de
la ligne d'edition
parent e29b2ce7
...@@ -68,12 +68,21 @@ function select_product_from_bc(barcode) { ...@@ -68,12 +68,21 @@ function select_product_from_bc(barcode) {
try { try {
if (editing_product == null) { if (editing_product == null) {
let p = barcodes.get_corresponding_odoo_product(barcode); let p = barcodes.get_corresponding_odoo_product(barcode);
var qtyIsWeight = false;
console.log(p);
if (p == null) { if (p == null) {
alert("Le code-barre " + barcode + " ne correspond à aucun article connu."); alert("Le code-barre " + barcode + " ne correspond à aucun article connu.");
return -1; return -1;
} }
console.log(p.rule);
if(p.rule == 'weight')
qtyIsWeight = true;
var found = {data: null, place: null}; var found = {data: null, place: null};
...@@ -92,6 +101,9 @@ function select_product_from_bc(barcode) { ...@@ -92,6 +101,9 @@ function select_product_from_bc(barcode) {
} }
}); });
} }
if(qtyIsWeight)
found.data.product_qty = p.qty;
if (found.data !== null) { if (found.data !== null) {
setLineEdition(found.data); setLineEdition(found.data);
...@@ -792,6 +804,8 @@ function set_supplier_shortage(row, product, from_processed = false) { ...@@ -792,6 +804,8 @@ function set_supplier_shortage(row, product, from_processed = false) {
// Set edition // Set edition
function setLineEdition(product) { function setLineEdition(product) {
editing_product = product; editing_product = product;
console.log(editing_product);
// name // name
document.getElementById('product_name').innerHTML = editing_product.product_id[1]; document.getElementById('product_name').innerHTML = editing_product.product_id[1];
......
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