Commit a57456e8 by Damien Moulard

display products details info

parent d34b217a
......@@ -192,7 +192,11 @@ function prepare_datatable_data() {
for (product of products) {
let item = {
id: product.id,
name: product.name
name: product.name,
default_code: product.default_code,
incoming_qty: +parseFloat(product.incoming_qty).toFixed(3), // + sign removes unecessary zeroes at the end
qty_available: +parseFloat(product.qty_available).toFixed(3),
uom: product.uom_id[1],
};
// If product not related to supplier : false ; else null (qty to be set) or qty
......@@ -220,12 +224,30 @@ function prepare_datatable_columns() {
{
data: "id",
title: "id",
visible: false
visible: false,
},
{
data: "default_code",
title: "Référence Produit",
width: "10%",
render: function (data) {
return (data === false) ? "" : data;
}
},
{
data: "name",
title: "Produit"
}
},
{
data: "qty_available",
title: "Stock",
width: "5%",
},
{
data: "incoming_qty",
title: "Quantité entrante",
width: "5%",
},
];
for (supplier of selected_suppliers) {
......@@ -247,6 +269,12 @@ function prepare_datatable_columns() {
});
}
columns.push({
data: "uom",
title: "UDM",
width: "5%",
})
return columns;
}
......@@ -350,5 +378,5 @@ $(document).ready(function() {
add_supplier();
});
// TODO: on click on 'X' change to input
// TODO: on click on 'X' change to input, make product available for this supplier
});
......@@ -406,18 +406,18 @@ class CagetteProducts(models.Model):
ptids = []
for p in psi:
if (p["product_tmpl_id"] is not False
and (p["date_start"] is False or p["date_start"] < today)
and (p["date_end"] is False or p["date_end"] < today)):
and (p["date_start"] is False or p["date_end"] is not False and p["date_start"] <= today)
and (p["date_end"] is False or p["date_end"] is not False and p["date_end"] >= today)):
ptids.append(p["product_tmpl_id"][0])
# Get products templates
f = ["id", "state", "product_variant_ids", "name"]
f = ["id", "state", "name", "default_code", "qty_available", "incoming_qty", "uom_id"]
c = [['id', 'in', ptids], ['purchase_ok', '=', True]]
products_t = api.search_read('product.template', c, f)
filtered_products_t = [p for p in products_t if p["state"] != "end" and p["state"] != "obsolete"]
# TODO get additional product data (product_variant_ids -> list of product.product)
# Note: if product.product is needed, get "product_variant_ids" from product template
res["products"] = filtered_products_t
except Exception as e:
print(str(e))
......
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