Commit 793d102f by François C.

Fix conflict

parents c16205e6 d66c0789
Pipeline #2162 passed with stage
in 1 minute 29 seconds
......@@ -520,6 +520,8 @@ class CagetteProducts(models.Model):
rules = OdooAPI().search_read('barcode.rule', c, ['pattern', 'type', 'alias'], order="sequence ASC")
# As rules are ordered by sequence, let's find where to stop (.* pattern)
stop_idx = len(rules) - 1
# .* (catchall) rules, if exists, may be not the last rule
# let's find it and set stop_idx consequently
i = 0
for r in rules:
if r['pattern'] == ".*":
......
......@@ -112,7 +112,14 @@ IFCBarcodes = {
// let's seek "normalized" bc in codes array or alias map
for (alias in this.aliases) {
if (bc == alias) {
/*
bc.indexOf(alias) === 0
could be enough,
but is used to keep in mind .* caracters
can be used in rules (have been cleaned before beeing here)
*/
if (bc == alias || bc.indexOf(alias) === 0) {
is_alias = true;
for (barcode in this.codes) {
if (barcode == this.aliases[alias]) {
......
......@@ -368,31 +368,30 @@ var addProductToList = async function(barcode) {
//It could also be a wrong reading one
odoo_product = barcodes.get_corresponding_odoo_product(barcode);
if (is_product_in_shelf_adding_queue_list(odoo_product.data[barcodes.keys.id])) {
console.log("Already added product");
} else {
add_to_shelf_product_ids.push(odoo_product.data[4]);
if (odoo_product === null) {
alert(barcode + ' : Code-barre inconnu');
if (odoo_product) {
if (is_product_in_shelf_adding_queue_list(odoo_product.data[barcodes.keys.id])) {
alert("Produit déjà présent dans la liste.");
} else {
var pdt_line = $('<tr>').attr('data-id', odoo_product.data[barcodes.keys.id])
.attr('data-bc', odoo_product.barcode)
.addClass('obc');
$('<td>').text(barcode)
.appendTo(pdt_line);
$('<td>').text(odoo_product.barcode)
.appendTo(pdt_line);
$('<td>').text(odoo_product.data[barcodes.keys.name])
.appendTo(pdt_line);
$('<td>').text(odoo_product.data[barcodes.keys.list_price] + " €")
.appendTo(pdt_line);
$('<td>').html(delete_icon)
.appendTo(pdt_line);
adding_pdts_tpl.find('#added_products tbody').append(pdt_line);
main_content.find('button.add-products').css('display', 'block')
.html(add_pdts_btn_text);
add_to_shelf_product_ids.push(odoo_product.data[4]);
if (odoo_product === null) {
alert(barcode + ' : Code-barre inconnu');
} else {
var pdt_line = $('<tr>').attr('data-id', odoo_product.data[barcodes.keys.id])
.attr('data-bc', odoo_product.barcode)
.addClass('obc');
$('<td>').text(barcode)
.appendTo(pdt_line);
$('<td>').text(odoo_product.barcode)
.appendTo(pdt_line);
$('<td>').text(odoo_product.data[barcodes.keys.name])
.appendTo(pdt_line);
$('<td>').html(delete_icon)
.appendTo(pdt_line);
adding_pdts_tpl.find('#added_products tbody').append(pdt_line);
main_content.find('button.add-products').css('display', 'block')
.html(add_pdts_btn_text);
}
}
}
};
......
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