Commit acd357d1 by François C.

Merge branch '3001-display-last-product-added-date' into 'dev_cooperatic'

INV: display last product added date

See merge request !169
parents b400240d 1eecca46
Pipeline #2173 passed with stage
in 1 minute 31 seconds
...@@ -58,7 +58,11 @@ def add_products(request): ...@@ -58,7 +58,11 @@ def add_products(request):
try: try:
id = int(request.POST.get('shelf_id')) id = int(request.POST.get('shelf_id'))
barcodes = json.loads(request.POST.get('bc')) barcodes = json.loads(request.POST.get('bc'))
result = Shelf(id).add_products_by_barcodes(barcodes) m = Shelf(id)
result = m.add_products_by_barcodes(barcodes)
# Update shelf last product added date
result["update_last_product_added_date"] = m.update_last_product_added_date()
except Exception as e: except Exception as e:
result['error'] = str(e) result['error'] = str(e)
else: else:
......
...@@ -32,6 +32,24 @@ function init_datatable() { ...@@ -32,6 +32,24 @@ function init_datatable() {
} }
}, },
{ {
data:"date_last_product_added",
title:"Dernier ajout produit",
render: function (data, type) {
// Sort on data, not rendering
if (type == "sort" || type == 'type')
return data;
if (data == '0001-01-01')
return "";
else {
var date = new Date(data);
return date.toLocaleDateString('fr-FR');
}
}
},
{
data:"date_last_inventory", data:"date_last_inventory",
title:"Dernier inventaire", title:"Dernier inventaire",
render: function (data, type) { render: function (data, type) {
......
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