Commit 9d0aaeff by Félicie

Merge branch 'dev_cooperatic' into 2821-inventory-optimization

parents 4716ad2b 793d102f
Pipeline #2166 passed with stage
in 1 minute 33 seconds
...@@ -15,8 +15,7 @@ function init_faq() { ...@@ -15,8 +15,7 @@ function init_faq() {
$("#coop_unsubscribe_form_link_btn").prop("href", coop_unsubscribe_form_link); $("#coop_unsubscribe_form_link_btn").prop("href", coop_unsubscribe_form_link);
$("#helper_subscribe_form_link_btn").prop("href", helper_subscribe_form_link); $("#helper_subscribe_form_link_btn").prop("href", helper_subscribe_form_link);
$("#helper_unsubscribe_form_link_btn").prop("href", helper_unsubscribe_form_link); $("#helper_unsubscribe_form_link_btn").prop("href", helper_unsubscribe_form_link);
$("#request_form_link_btn2").prop("href", request_form_link); $(".ask_bdm_form_link").prop("href", request_form_link);
$("#request_form_link_btn").prop("href", request_form_link);
display_messages_for_attached_people(); display_messages_for_attached_people();
} }
......
...@@ -520,6 +520,8 @@ class CagetteProducts(models.Model): ...@@ -520,6 +520,8 @@ class CagetteProducts(models.Model):
rules = OdooAPI().search_read('barcode.rule', c, ['pattern', 'type', 'alias'], order="sequence ASC") 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) # As rules are ordered by sequence, let's find where to stop (.* pattern)
stop_idx = len(rules) - 1 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 i = 0
for r in rules: for r in rules:
if r['pattern'] == ".*": if r['pattern'] == ".*":
......
...@@ -112,7 +112,14 @@ IFCBarcodes = { ...@@ -112,7 +112,14 @@ IFCBarcodes = {
// let's seek "normalized" bc in codes array or alias map // let's seek "normalized" bc in codes array or alias map
for (alias in this.aliases) { 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; is_alias = true;
for (barcode in this.codes) { for (barcode in this.codes) {
if (barcode == this.aliases[alias]) { if (barcode == this.aliases[alias]) {
......
...@@ -368,29 +368,30 @@ var addProductToList = async function(barcode) { ...@@ -368,29 +368,30 @@ var addProductToList = async function(barcode) {
//It could also be a wrong reading one //It could also be a wrong reading one
odoo_product = barcodes.get_corresponding_odoo_product(barcode); odoo_product = barcodes.get_corresponding_odoo_product(barcode);
if (odoo_product) {
if (is_product_in_shelf_adding_queue_list(odoo_product.data[barcodes.keys.id])) { if (is_product_in_shelf_adding_queue_list(odoo_product.data[barcodes.keys.id])) {
console.log("Already added product"); alert("Produit déjà présent dans la liste.");
} else {
add_to_shelf_product_ids.push(odoo_product.data[4]);
if (odoo_product === null) {
alert(barcode + ' : Code-barre inconnu');
} else { } else {
var pdt_line = $('<tr>').attr('data-id', odoo_product.data[barcodes.keys.id]) add_to_shelf_product_ids.push(odoo_product.data[4]);
.attr('data-bc', odoo_product.barcode) if (odoo_product === null) {
.addClass('obc'); alert(barcode + ' : Code-barre inconnu');
} else {
$('<td>').text(barcode) var pdt_line = $('<tr>').attr('data-id', odoo_product.data[barcodes.keys.id])
.appendTo(pdt_line); .attr('data-bc', odoo_product.barcode)
$('<td>').text(odoo_product.barcode) .addClass('obc');
.appendTo(pdt_line);
$('<td>').text(odoo_product.data[barcodes.keys.name]) $('<td>').text(barcode)
.appendTo(pdt_line); .appendTo(pdt_line);
$('<td>').html(delete_icon) $('<td>').text(odoo_product.barcode)
.appendTo(pdt_line); .appendTo(pdt_line);
adding_pdts_tpl.find('#added_products tbody').append(pdt_line); $('<td>').text(odoo_product.data[barcodes.keys.name])
main_content.find('button.add-products').css('display', 'block') .appendTo(pdt_line);
.html(add_pdts_btn_text); $('<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);
}
} }
} }
}; };
......
...@@ -157,8 +157,8 @@ ...@@ -157,8 +157,8 @@
href="javascript:void(0);" href="javascript:void(0);"
target="_blank" target="_blank"
type="button" type="button"
class="btn--primary faq_link_button" class="btn--primary faq_link_button ask_bdm_form_link"
id="request_form_link_btn2" id="request_form_link_btn3"
> >
Oubli validation service Oubli validation service
</a> </a>
...@@ -308,7 +308,7 @@ ...@@ -308,7 +308,7 @@
href="javascript:void(0);" href="javascript:void(0);"
target="_blank" target="_blank"
type="button" type="button"
class="btn--primary faq_link_button" class="btn--primary faq_link_button ask_bdm_form_link"
id="request_form_link_btn2" id="request_form_link_btn2"
> >
Faire une demande au BDM Faire une demande au BDM
...@@ -505,7 +505,7 @@ ...@@ -505,7 +505,7 @@
href="javascript:void(0);" href="javascript:void(0);"
target="_blank" target="_blank"
type="button" type="button"
class="btn--primary faq_link_button" class="btn--primary faq_link_button ask_bdm_form_link"
id="request_form_link_btn" id="request_form_link_btn"
> >
Faire une demande au BDM Faire une demande au BDM
......
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
<th>Code-barre lu</th> <th>Code-barre lu</th>
<th>Code-barre Odoo</th> <th>Code-barre Odoo</th>
<th>Article</th> <th>Article</th>
<th>Prix</th>
<th>Action</th> <th>Action</th>
</tr> </tr>
</thead> </thead>
......
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