Commit 30088156 by Alexis Aoun

correction d une erreur de lint et arrondissement des nombres au centieme

parent 18d6f8ba
......@@ -30,7 +30,10 @@ var reception_status = null,
updatedProducts = [], // Keep record of updated products
validProducts = [], // Keep record of directly validated products
updateType = "", // step 1: qty_valid; step2: br_valid
barcodes = null; // Barcodes stored locally
barcodes = null, // Barcodes stored locally
priceToWeightIsCorrect = true,
found = {data: null, place: null},
p = null;
var dbc = null,
sync = null,
......@@ -67,11 +70,11 @@ function searchUpdatedProduct() {
function select_product_from_bc(barcode) {
try {
if (editing_product == null) {
let p = barcodes.get_corresponding_odoo_product(barcode);
p = barcodes.get_corresponding_odoo_product(barcode);
var qtyIsWeight = false;
var qtyIsPriceToWeight = false;
var priceToWeightIsCorrect = true;
priceToWeightIsCorrect = true;
found = {data: null, place: null};
console.log(p);
......@@ -88,7 +91,6 @@ function select_product_from_bc(barcode) {
else if(p.rule == 'price_to_weight')
qtyIsPriceToWeight = true;
var found = {data: null, place: null};
$.each(list_to_process, function(i, e) {
if (e.product_id[0] == p.data[barcodes['keys']['id']]) {
......@@ -129,31 +131,6 @@ function select_product_from_bc(barcode) {
document.getElementsByClassName("btn--success")[0].style.display = "";
}
//TODO not the cleanest way to manage the callback, needs improvement
//TODO too much repeating code, needs refactor
function price_to_weight_confirmed(){
console.log("confirming")
if(priceToWeightIsCorrect)
found.data.product_qty = p.qty;
else
found.data.product_qty = p.value/document.getElementById("new_price_to_weight").value;
if (found.data !== null) {
setLineEdition(found.data);
if (found.place === 'to_process') {
let row = table_to_process.row($('#'+found.data.product_id[0]));
remove_from_toProcess(row, found.data);
}
}
}
function price_to_weight_is_wrong(){
document.getElementById("new_price_to_weight").style.display = "";
document.getElementsByClassName("btn--success")[0].style.display = "none";
document.querySelector('#modal_closebtn_bottom').innerHTML = 'OK';
priceToWeightIsCorrect = false;
}
if (found.data !== null && !qtyIsPriceToWeight) {
setLineEdition(found.data);
......@@ -218,6 +195,32 @@ function update_distant_orders() {
});
}
//TODO not the cleanest way to manage the callback, needs improvement
//TODO too much repeating code, needs refactor
function price_to_weight_confirmed(){
console.log("confirming")
if(priceToWeightIsCorrect)
found.data.product_qty = p.qty;
else
found.data.product_qty = (p.value/document.getElementById("new_price_to_weight").value).toFixed(2);
if (found.data !== null) {
setLineEdition(found.data);
if (found.place === 'to_process') {
let row = table_to_process.row($('#'+found.data.product_id[0]));
remove_from_toProcess(row, found.data);
}
}
}
function price_to_weight_is_wrong(){
document.getElementById("new_price_to_weight").style.display = "";
document.getElementsByClassName("btn--success")[0].style.display = "none";
document.querySelector('#modal_closebtn_bottom').innerHTML = 'OK';
priceToWeightIsCorrect = false;
}
/* INIT */
// Get order(s) data from server
......@@ -934,7 +937,7 @@ function editProductInfo (productToEdit, value = null, batch = false) {
if (e.product_id[0] == productToEdit.product_id[0]) {
addition = true;
productToEdit = e;
newValue = newValue + productToEdit.product_qty;
newValue = (newValue + productToEdit.product_qty).toFixed(2);
}
});
// If qty edition & Check if qty changed
......
......@@ -181,7 +181,7 @@
<h3>Confirmation du prix</h3>
<p>Est ce que le prix au kilo du produit <b><span id="product_to_verify"></span></b>
est bien <b><span id="price_to_verify"></span></b> euros/Kg ?</p>
<textarea name="Prix au Kilo" id="new_price_to_weight" cols="30" rows="1"></textarea>
<textarea name="Prix au Kilo" id="new_price_to_weight" cols="3" rows="1"></textarea>
</div>
</div>
<br/>
......
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