Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
third-party
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cooperatic-foodcoops
third-party
Commits
e29e6648
Commit
e29e6648
authored
Oct 31, 2022
by
François C.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Orders helper : display per week consumption by setting option
parent
00a490e0
Pipeline
#2476
passed with stage
in 1 minute 26 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
6 deletions
+31
-6
orders_helper.js
orders/static/js/orders_helper.js
+14
-4
views.py
orders/views.py
+3
-1
config.md
outils/config.md
+10
-0
explanations.html
templates/orders/explanations.html
+2
-1
helper.html
templates/orders/helper.html
+2
-0
No files found.
orders/static/js/orders_helper.js
View file @
e29e6648
...
@@ -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
({
...
...
orders/views.py
View file @
e29e6648
...
@@ -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'
)
...
...
outils/config.md
View file @
e29e6648
...
@@ -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
...
...
templates/orders/explanations.html
View file @
e29e6648
...
@@ -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.
...
...
templates/orders/helper.html
View file @
e29e6648
...
@@ -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>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment