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
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
Alexis AOUN
third-party
Commits
f39147fa
Commit
f39147fa
authored
Jul 01, 2021
by
Damien Moulard
Committed by
Alexis Aoun
Jul 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
display fixes
parent
bd194cd1
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 @
f39147fa
...
@@ -91,11 +91,11 @@
...
@@ -91,11 +91,11 @@
#supplier_input
{
#supplier_input
{
width
:
350px
;
width
:
350px
;
border-radius
:
8
px
;
border-radius
:
3
px
;
}
}
#date_planned_input
,
#coverage_days_input
{
#date_planned_input
,
#coverage_days_input
{
border-radius
:
8
px
;
border-radius
:
3
px
;
}
}
/* -- Table */
/* -- Table */
...
@@ -106,7 +106,7 @@
...
@@ -106,7 +106,7 @@
#products_table_filter
input
{
#products_table_filter
input
{
height
:
35px
;
height
:
35px
;
width
:
300px
;
width
:
300px
;
border-radius
:
10
px
;
border-radius
:
3
px
;
}
}
#products_table
.help
{
cursor
:
help
;}
#products_table
.help
{
cursor
:
help
;}
#table_header_select_all
{
#table_header_select_all
{
...
...
orders/static/js/orders_helper.js
View file @
f39147fa
...
@@ -166,28 +166,26 @@ function compute_products_coverage_qties() {
...
@@ -166,28 +166,26 @@ function compute_products_coverage_qties() {
key
,
key
,
product
product
]
of
Object
.
entries
(
products
))
{
]
of
Object
.
entries
(
products
))
{
let
purchase_qty_for_coverage
=
null
;
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
;
// Durée couverture produit = (stock + qté entrante + qté commandée ) / conso quotidienne
const
incoming_qty
=
product
.
incoming_qty
;
const
stock
=
product
.
qty_available
;
const
daily_conso
=
product
.
daily_conso
;
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
;
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
;
// 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
)
{
// Round up to unit for all products
purchase_package_qty_for_coverage
=
parseFloat
(
purchase_package_qty_for_coverage
).
toFixed
(
0
);
purchase_package_qty_for_coverage
=
Math
.
ceil
(
purchase_package_qty_for_coverage
);
}
else
{
purchase_package_qty_for_coverage
=
parseFloat
(
purchase_package_qty_for_coverage
).
toFixed
(
2
);
// 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
;
}
}
}
}
...
@@ -199,6 +197,14 @@ function check_products_data() {
...
@@ -199,6 +197,14 @@ function check_products_data() {
const
product_ids
=
products
.
map
(
p
=>
p
.
id
);
const
product_ids
=
products
.
map
(
p
=>
p
.
id
);
if
(
product_ids
.
length
>
0
)
{
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>`
);
clicked_order_pill
.
find
(
'.pill_order_name'
).
empty
().
append
(
`<i class="fas fa-spinner fa-spin"></i>`
);
$
.
ajax
({
$
.
ajax
({
...
@@ -216,6 +222,7 @@ function check_products_data() {
...
@@ -216,6 +222,7 @@ function check_products_data() {
products
[
p_index
]
=
{
...
products
[
p_index
],
...
product
};
products
[
p_index
]
=
{
...
products
[
p_index
],
...
product
};
}
}
$
(
'.notifyjs-wrapper'
).
trigger
(
'notify-hide'
);
resolve
();
resolve
();
},
},
error
:
function
(
data
)
{
error
:
function
(
data
)
{
...
@@ -226,6 +233,7 @@ function check_products_data() {
...
@@ -226,6 +233,7 @@ function check_products_data() {
report_JS_error
(
err
,
'orders'
);
report_JS_error
(
err
,
'orders'
);
alert
(
`Erreur lors de la vérification des données des articles. Certaines données peuvent être erronées`
);
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
// Don't block process if this call fails
resolve
();
resolve
();
}
}
...
@@ -991,7 +999,7 @@ function prepare_datatable_data(product_ids = []) {
...
@@ -991,7 +999,7 @@ function prepare_datatable_data(product_ids = []) {
daily_conso
:
product
.
daily_conso
,
daily_conso
:
product
.
daily_conso
,
purchase_ok
:
product
.
purchase_ok
,
purchase_ok
:
product
.
purchase_ok
,
uom
:
product
.
uom_id
[
1
],
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
);
const
computed_data
=
_compute_product_data
(
product
);
...
@@ -1025,7 +1033,7 @@ function prepare_datatable_columns() {
...
@@ -1025,7 +1033,7 @@ function prepare_datatable_columns() {
},
},
{
{
data
:
"default_code"
,
data
:
"default_code"
,
title
:
"R
éférence Produit
"
,
title
:
"R
ef
"
,
width
:
"8%"
,
width
:
"8%"
,
render
:
function
(
data
)
{
render
:
function
(
data
)
{
return
(
data
===
false
)
?
""
:
data
;
return
(
data
===
false
)
?
""
:
data
;
...
@@ -1114,7 +1122,7 @@ function prepare_datatable_columns() {
...
@@ -1114,7 +1122,7 @@ function prepare_datatable_columns() {
columns
.
push
({
columns
.
push
({
data
:
"days_not_covered"
,
data
:
"days_not_covered"
,
title
:
"Besoin non couvert"
,
title
:
"Besoin non couvert
(jours)
"
,
className
:
"dt-body-center"
,
className
:
"dt-body-center"
,
width
:
"4%"
width
:
"4%"
});
});
...
...
products/models.py
View file @
f39147fa
...
@@ -503,8 +503,8 @@ class CagetteProducts(models.Model):
...
@@ -503,8 +503,8 @@ class CagetteProducts(models.Model):
sales_average_params
=
{
sales_average_params
=
{
'ids'
:
ptids
,
'ids'
:
ptids
,
# 'from': '2019-06
-10',
'from'
:
'2019-04
-10'
,
#
'to': '2019-08-10',
'to'
:
'2019-08-10'
,
}
}
sales
=
CagetteProducts
.
get_template_products_sales_average
(
sales_average_params
)
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