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
261
Issues
261
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Paul
third-party
Commits
419d56c0
Commit
419d56c0
authored
Jul 01, 2021
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
display fixes
parent
46ef6a41
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
29 deletions
+37
-29
oders_helper_style.css
orders/static/css/oders_helper_style.css
+3
-3
orders_helper.js
orders/static/js/orders_helper.js
+32
-24
models.py
products/models.py
+2
-2
No files found.
orders/static/css/oders_helper_style.css
View file @
419d56c0
...
...
@@ -91,11 +91,11 @@
#supplier_input
{
width
:
350px
;
border-radius
:
8
px
;
border-radius
:
3
px
;
}
#date_planned_input
,
#coverage_days_input
{
border-radius
:
8
px
;
border-radius
:
3
px
;
}
/* -- Table */
...
...
@@ -106,7 +106,7 @@
#products_table_filter
input
{
height
:
35px
;
width
:
300px
;
border-radius
:
10
px
;
border-radius
:
3
px
;
}
#products_table
.help
{
cursor
:
help
;}
#table_header_select_all
{
...
...
orders/static/js/orders_helper.js
View file @
419d56c0
...
...
@@ -167,28 +167,26 @@ function compute_products_coverage_qties() {
key
,
product
]
of
Object
.
entries
(
products
))
{
let
purchase_qty_for_coverage
=
null
;
// Durée couverture produit = (stock + qté entrante + qté commandée ) / conso quotidienne
const
stock
=
product
.
qty_available
;
const
incoming_qty
=
product
.
incoming_qty
;
const
daily_conso
=
product
.
daily_conso
;
purchase_qty_for_coverage
=
order_doc
.
coverage_days
*
daily_conso
-
stock
-
incoming_qty
;
purchase_qty_for_coverage
=
(
purchase_qty_for_coverage
<
0
)
?
0
:
purchase_qty_for_coverage
;
// Reduce to nb of packages to purchase
purchase_package_qty_for_coverage
=
purchase_qty_for_coverage
/
product
.
suppliersinfo
[
0
].
package_qty
;
// Round according to uom
if
(
product
.
uom_id
[
0
]
==
1
||
product
.
uom_id
[
0
]
==
20
)
{
purchase_package_qty_for_coverage
=
parseFloat
(
purchase_package_qty_for_coverage
).
toFixed
(
0
);
}
else
{
purchase_package_qty_for_coverage
=
parseFloat
(
purchase_package_qty_for_coverage
).
toFixed
(
2
);
if
(
'suppliersinfo'
in
product
&&
product
.
suppliersinfo
.
length
>
0
)
{
let
purchase_qty_for_coverage
=
null
;
// Durée couverture produit = (stock + qté entrante + qté commandée ) / conso quotidienne
const
stock
=
product
.
qty_available
;
const
incoming_qty
=
product
.
incoming_qty
;
const
daily_conso
=
product
.
daily_conso
;
purchase_qty_for_coverage
=
order_doc
.
coverage_days
*
daily_conso
-
stock
-
incoming_qty
;
purchase_qty_for_coverage
=
(
purchase_qty_for_coverage
<
0
)
?
0
:
purchase_qty_for_coverage
;
// Reduce to nb of packages to purchase
purchase_package_qty_for_coverage
=
purchase_qty_for_coverage
/
product
.
suppliersinfo
[
0
].
package_qty
;
// Round up to unit for all products
purchase_package_qty_for_coverage
=
Math
.
ceil
(
purchase_package_qty_for_coverage
);
// Set qty to purchase for first supplier only
products
[
key
].
suppliersinfo
[
0
].
qty
=
purchase_package_qty_for_coverage
;
}
// Set qty to purchase for first supplier only
products
[
key
].
suppliersinfo
[
0
].
qty
=
purchase_package_qty_for_coverage
;
}
}
...
...
@@ -200,6 +198,14 @@ function check_products_data() {
const
product_ids
=
products
.
map
(
p
=>
p
.
id
);
if
(
product_ids
.
length
>
0
)
{
$
.
notify
(
"Vérfication des informations produits..."
,
{
globalPosition
:
"top left"
,
className
:
"warning"
}
);
clicked_order_pill
.
find
(
'.pill_order_name'
).
empty
().
append
(
`<i class="fas fa-spinner fa-spin"></i>`
);
$
.
ajax
({
...
...
@@ -217,6 +223,7 @@ function check_products_data() {
products
[
p_index
]
=
{
...
products
[
p_index
],
...
product
};
}
$
(
'.notifyjs-wrapper'
).
trigger
(
'notify-hide'
);
resolve
();
},
error
:
function
(
data
)
{
...
...
@@ -227,6 +234,7 @@ function check_products_data() {
report_JS_error
(
err
,
'orders'
);
alert
(
`Erreur lors de la vérification des données des articles. Certaines données peuvent être erronées`
);
$
(
'.notifyjs-wrapper'
).
trigger
(
'notify-hide'
);
// Don't block process if this call fails
resolve
();
}
...
...
@@ -992,7 +1000,7 @@ function prepare_datatable_data(product_ids = []) {
daily_conso
:
product
.
daily_conso
,
purchase_ok
:
product
.
purchase_ok
,
uom
:
product
.
uom_id
[
1
],
stats
:
"Ecart type: "
+
product
.
sigma
+
", % jours sans vente = "
+
(
product
.
vpc
)
*
100
stats
:
`Ecart type:
${
product
.
sigma
}
/ Jours sans vente:
${(
product
.
vpc
)
*
100
}
%`
};
const
computed_data
=
_compute_product_data
(
product
);
...
...
@@ -1026,7 +1034,7 @@ function prepare_datatable_columns() {
},
{
data
:
"default_code"
,
title
:
"R
éférence Produit
"
,
title
:
"R
ef
"
,
width
:
"8%"
,
render
:
function
(
data
)
{
return
(
data
===
false
)
?
""
:
data
;
...
...
@@ -1115,7 +1123,7 @@ function prepare_datatable_columns() {
columns
.
push
({
data
:
"days_not_covered"
,
title
:
"Besoin non couvert"
,
title
:
"Besoin non couvert
(jours)
"
,
className
:
"dt-body-center"
,
width
:
"4%"
});
...
...
products/models.py
View file @
419d56c0
...
...
@@ -503,8 +503,8 @@ class CagetteProducts(models.Model):
sales_average_params
=
{
'ids'
:
ptids
,
# 'from': '2019-06
-10',
#
'to': '2019-08-10',
'from'
:
'2019-04
-10'
,
'to'
:
'2019-08-10'
,
}
sales
=
CagetteProducts
.
get_template_products_sales_average
(
sales_average_params
)
...
...
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