Commit a98a686b by François C.

Add total to stock valuation

parent 8db70778
...@@ -373,6 +373,8 @@ class CagetteStock(models.Model): ...@@ -373,6 +373,8 @@ class CagetteStock(models.Model):
cond = [['qty_available','>', 0], ['active', '=', True]] cond = [['qty_available','>', 0], ['active', '=', True]]
fields = ["barcode", "display_name", "qty_available", "standard_price"] fields = ["barcode", "display_name", "qty_available", "standard_price"]
articles = api.search_read('product.product', cond, fields, 1000000) articles = api.search_read('product.product', cond, fields, 1000000)
for a in articles:
a['total'] = a['qty_available'] * a['standard_price']
except Exception as e: except Exception as e:
coop_logger.error("Erreur get_valuable_stock : %s", str(e)) coop_logger.error("Erreur get_valuable_stock : %s", str(e))
return articles return articles
......
...@@ -6,14 +6,29 @@ $(document).ready(function() { ...@@ -6,14 +6,29 @@ $(document).ready(function() {
"data": "" "data": ""
}, },
"columns":[ "columns":[
{data:"barcode", "title":"Code-barre", "width": "50%"}, {data:"barcode", "title":"Code-barre", "width": "10em"},
{data:"display_name", "title":"Article", "width": "50%"}, {data:"display_name", "title":"Article", "width": "50%"},
{data:"qty_available", "title":"Stock", "width":"15%" {data:"qty_available", "title":"Stock", "width":"5em",
render: function(data) {
if (data == parseInt(data,10)) {
return data
} else {
return data.toFixed(3)
}
}
}, },
{data:"standard_price", "title":"Prix achat", "width":"15%" {data:"standard_price", "title":"Prix Achat", "width":"4em",
} render: function(data) {
return data.toFixed(2)
}
},
{data: "total", "title": "Total",
render: function(data, type, full) {
return data.toFixed(2)
}
}
], ],
...@@ -24,7 +39,7 @@ $(document).ready(function() { ...@@ -24,7 +39,7 @@ $(document).ready(function() {
"desc" "desc"
] ]
], ],
"iDisplayLength": 50, "paging": true,
"language": { "language": {
"emptyTable": "Pas de donnée", "emptyTable": "Pas de donnée",
"info": "Affiché : lignes _START_ à _END_ sur _TOTAL_", "info": "Affiché : lignes _START_ à _END_ sur _TOTAL_",
...@@ -55,6 +70,6 @@ $(document).ready(function() { ...@@ -55,6 +70,6 @@ $(document).ready(function() {
className: 'btn--primary btn_export' className: 'btn--primary btn_export'
}, },
], ],
dom: '<lr<t>ip><"clear"><B>', dom: '<lr<t>ip><"clear"><B>'
}); });
}); });
\ No newline at end of file
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