Commit e29e6648 by François C.

Orders helper : display per week consumption by setting option

parent 00a490e0
Pipeline #2476 passed with stage
in 1 minute 26 seconds
...@@ -1667,8 +1667,11 @@ function prepare_datatable_columns() { ...@@ -1667,8 +1667,11 @@ function prepare_datatable_columns() {
title: "Quantité entrante", title: "Quantité entrante",
className: "dt-body-center", className: "dt-body-center",
width: "4%" width: "4%"
}, }
{
];
let conso = {
data: "daily_conso", data: "daily_conso",
title: "Conso moy /jour", title: "Conso moy /jour",
render: function (data, type, full) { render: function (data, type, full) {
...@@ -1676,8 +1679,15 @@ function prepare_datatable_columns() { ...@@ -1676,8 +1679,15 @@ function prepare_datatable_columns() {
}, },
className: "dt-body-center", className: "dt-body-center",
width: "4%" width: "4%"
} };
];
if (consumption_average_unit === 'week') {
conso.title = "Conso moy/sem."
conso.render = function (data, type, full) {
return (parseFloat(data, 10) * open_days_per_week).toFixed(2);
};
}
columns.push(conso);
for (const supplier of selected_suppliers) { for (const supplier of selected_suppliers) {
columns.push({ columns.push({
......
...@@ -23,7 +23,9 @@ def helper(request): ...@@ -23,7 +23,9 @@ def helper(request):
'odoo_server': settings.ODOO['url'], 'odoo_server': settings.ODOO['url'],
'metabase_url': getattr(settings, 'ORDERS_HELPER_METABASE_URL', ''), 'metabase_url': getattr(settings, 'ORDERS_HELPER_METABASE_URL', ''),
'nb_past_days_to_compute_sales_average': OdooAPI().get_system_param('lacagette_products.nb_past_days_to_compute_sales_average'), 'nb_past_days_to_compute_sales_average': OdooAPI().get_system_param('lacagette_products.nb_past_days_to_compute_sales_average'),
'nb_of_consecutive_non_sale_days_considered_as_break': OdooAPI().get_system_param('lacagette_products.nb_of_consecutive_non_sale_days_considered_as_break') 'nb_of_consecutive_non_sale_days_considered_as_break': OdooAPI().get_system_param('lacagette_products.nb_of_consecutive_non_sale_days_considered_as_break'),
'consumption_average_unit': getattr(settings, 'CONSUMPTION_AVERAGE_UNIT', 'day'),
'open_days_per_week': getattr(settings, 'OPEN_DAYS_PER_WEEK', 6)
} }
template = loader.get_template('orders/helper.html') template = loader.get_template('orders/helper.html')
......
...@@ -425,6 +425,16 @@ ...@@ -425,6 +425,16 @@
These shelfs (odoo ids) will be shown first in select list These shelfs (odoo ids) will be shown first in select list
### Orders helper
- OPEN_DAYS_PER_WEEK = 5
Default is 6. From monday to saturday
- CONSUMPTION_AVERAGE_UNIT = 'week'
'day' is default. All consumption figures are qty/day. This parameter is for display only.
### New members space ### New members space
- USE_NEW_MEMBERS_SPACE = True - USE_NEW_MEMBERS_SPACE = True
......
...@@ -53,7 +53,8 @@ ...@@ -53,7 +53,8 @@
<div class="txtleft" style="display: none;"> <div class="txtleft" style="display: none;">
La quantité à commander pour couvrir les besoins (en jours ou à partir d'un montant en €) est le résultat de : La quantité à commander pour couvrir les besoins (en jours ou à partir d'un montant en €) est le résultat de :
<p> <p>
(<em>nb_jours</em> <strong>x</strong> <em>conso_moyenne</em>) <strong>-</strong> <em>stock_existant</em> <strong>-</strong> <em>quantités_entrantes</em> <strong>+</strong> <em>stock_minimum</em> (<em>nb_jours</em> <strong>x</strong> <em>conso_moyenne</em>) <strong>-</strong> <em>stock_existant</em> <strong>-</strong> <em>quantités_entrantes</em> <br/>
Si la quantité est inférieure à <em>stock_minimum</em> alors c'est la valeur de <em>stock_minimum</em> qui est prise.
</p> </p>
<p> <p>
Pour plus de précisions, ce résultat peut-être ensuite ajusté en pourcentage. Pour plus de précisions, ce résultat peut-être ensuite ajusté en pourcentage.
......
...@@ -369,6 +369,8 @@ ...@@ -369,6 +369,8 @@
var couchdb_server = '{{couchdb_server}}' + couchdb_dbname; var couchdb_server = '{{couchdb_server}}' + couchdb_dbname;
var odoo_server = '{{odoo_server}}'; var odoo_server = '{{odoo_server}}';
var metabase_url = '{{metabase_url}}'; var metabase_url = '{{metabase_url}}';
let consumption_average_unit = '{{consumption_average_unit}}';
let open_days_per_week = {{open_days_per_week}};
</script> </script>
<script src="{% static "js/all_common.js" %}?v=1651853225"></script> <script src="{% static "js/all_common.js" %}?v=1651853225"></script>
<script type="text/javascript" src="{% static 'js/orders_helper.js' %}?v=1651853225"></script> <script type="text/javascript" src="{% static 'js/orders_helper.js' %}?v=1651853225"></script>
......
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