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
560b2c07
Commit
560b2c07
authored
Sep 22, 2023
by
Yvon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
4809 : remove shelf value and all associated code + not in use already commented out code
parent
97a032e3
Pipeline
#2977
failed with stage
in 1 minute 6 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
0 additions
and
155 deletions
+0
-155
shelfs_index.js
shelfs/static/js/shelfs_index.js
+0
-99
shelfs_sales.js
shelfs/static/js/shelfs_sales.js
+0
-34
urls.py
shelfs/urls.py
+0
-1
views.py
shelfs/views.py
+0
-21
No files found.
shelfs/static/js/shelfs_index.js
View file @
560b2c07
...
@@ -80,57 +80,6 @@ function init_datatable() {
...
@@ -80,57 +80,6 @@ function init_datatable() {
},
},
{
data
:
"p_nb"
,
title
:
"Nombre de réfs"
,
width
:
"5%"
,
className
:
"dt-body-center clickable"
},
{
data
:
"p_nb"
,
title
:
"Nombre de réfs"
,
width
:
"5%"
,
className
:
"dt-body-center clickable"
},
{
{
data
:
"shelf_value"
,
title
:
"Valeur théorique du rayon"
,
render
:
function
(
data
,
type
)
{
if
(
type
==
"sort"
||
type
==
'type'
)
return
data
;
if
(
data
==
-
1
)
{
// Code: server send empty field -> loading
return
'<i class="fas fa-spinner fa-spin"></i>'
;
}
else
if
(
data
==
-
2
)
{
// Code: error getting data from server
return
'/'
;
}
else
{
return
data
+
' €'
;
}
},
width
:
"5%"
,
className
:
"dt-body-center clickable"
},
/* NOT IN USE */
// {
// data:"last_inv_delta_percentage",
// title:"Delta (dernier inv.)",
// width: "5%",
// className:"dt-body-center",
// render: function (data, type) {
// if (type == "sort" || type == 'type')
// return data;
// if (data == -99999999) {
// return '/';
// } else {
// return data + ' %';
// }
// }
// },
// {
// data:"last_inv_losses_percentage",
// title:"Pertes (dernier inv.)",
// width: "5%",
// className:"dt-body-center",
// render: function (data, type) {
// if (type == "sort" || type == 'type')
// return data;
// if (data == -99999999) {
// return '/';
// } else {
// return data + ' %';
// }
// }
// },
{
data
:
"inventory_status"
,
data
:
"inventory_status"
,
title
:
"Inventaire à faire"
,
title
:
"Inventaire à faire"
,
className
:
"dt-body-center"
,
className
:
"dt-body-center"
,
...
@@ -164,53 +113,6 @@ function init_datatable() {
...
@@ -164,53 +113,6 @@ function init_datatable() {
});
});
}
}
function
get_shelfs_extra_data
()
{
try
{
$
.
ajax
({
type
:
'GET'
,
url
:
'/shelfs/get_shelves_extra_data'
,
dataType
:
"json"
,
traditional
:
true
,
contentType
:
"application/json; charset=utf-8"
,
success
:
function
(
data
)
{
for
(
item
of
data
.
res
)
{
var
row_data
=
shelfs_table
.
row
(
'#'
+
item
.
id
).
data
();
row_data
.
shelf_value
=
item
.
shelf_value
;
shelfs_table
.
row
(
'#'
+
item
.
id
)
.
data
(
row_data
)
.
draw
();
}
},
error
:
function
(
data
)
{
if
(
typeof
data
.
responseJSON
!=
'undefined'
)
{
console
.
log
(
data
.
responseJSON
);
}
set_null_to_extra_data
();
}
});
}
catch
(
e
)
{
console
.
log
(
e
);
set_null_to_extra_data
();
}
}
function
set_null_to_extra_data
()
{
shelfs_table
.
rows
().
every
(
function
()
{
var
d
=
this
.
data
();
d
.
shelf_value
=
-
2
;
this
.
invalidate
();
// invalidate the data DataTables has cached for this row
return
1
;
});
shelfs_table
.
draw
();
}
var
getRowData
=
function
(
clicked
)
{
var
getRowData
=
function
(
clicked
)
{
var
row
=
shelfs_table
.
row
(
clicked
.
parents
(
'tr'
));
var
row
=
shelfs_table
.
row
(
clicked
.
parents
(
'tr'
));
...
@@ -324,7 +226,6 @@ $(document).ready(function() {
...
@@ -324,7 +226,6 @@ $(document).ready(function() {
}
}
shelfs_table
=
init_datatable
();
shelfs_table
=
init_datatable
();
get_shelfs_extra_data
();
$
(
document
).
on
(
'click'
,
'button.do_shelf_inventory'
,
go_to_shelf_inventory
);
$
(
document
).
on
(
'click'
,
'button.do_shelf_inventory'
,
go_to_shelf_inventory
);
$
(
document
).
on
(
'click'
,
'tbody td .delete_ongoing_inv_icon'
,
pre_delete_ongoing_inventory
);
$
(
document
).
on
(
'click'
,
'tbody td .delete_ongoing_inv_icon'
,
pre_delete_ongoing_inventory
);
...
...
shelfs/static/js/shelfs_sales.js
View file @
560b2c07
...
@@ -84,40 +84,6 @@ function go_to_shelf_view() {
...
@@ -84,40 +84,6 @@ function go_to_shelf_view() {
document
.
location
.
href
=
"shelf_view/"
+
row_data
.
id
;
document
.
location
.
href
=
"shelf_view/"
+
row_data
.
id
;
}
}
function
get_shelfs_sales_data
()
{
try
{
$
.
ajax
({
type
:
'GET'
,
url
:
'/shelfs/get_shelves_sales_data'
,
dataType
:
"json"
,
traditional
:
true
,
contentType
:
"application/json; charset=utf-8"
,
success
:
function
(
data
)
{
for
(
item
of
data
.
res
)
{
var
row_data
=
shelfs_table
.
row
(
'#'
+
item
.
id
).
data
();
row_data
.
shelf_value
=
item
.
shelf_value
;
shelfs_table
.
row
(
'#'
+
item
.
id
)
.
data
(
row_data
)
.
draw
();
}
},
error
:
function
(
data
)
{
if
(
typeof
data
.
responseJSON
!=
'undefined'
)
{
console
.
log
(
data
.
responseJSON
);
}
}
});
}
catch
(
e
)
{
err
=
{
msg
:
e
.
toString
(),
ctx
:
'get_shelfs_sales_data'
};
report_JS_error
(
err
,
'shelfs'
);
}
}
function
export_sales_data
(
event
)
{
function
export_sales_data
(
event
)
{
event
.
stopImmediatePropagation
();
event
.
stopImmediatePropagation
();
var
clicked
=
$
(
this
);
var
clicked
=
$
(
this
);
...
...
shelfs/urls.py
View file @
560b2c07
...
@@ -10,7 +10,6 @@ urlpatterns = [
...
@@ -10,7 +10,6 @@ urlpatterns = [
url
(
r'^shelf_inventory/([0-9]+)$'
,
views
.
shelf_inventory
),
url
(
r'^shelf_inventory/([0-9]+)$'
,
views
.
shelf_inventory
),
url
(
r'^inventory_process_state/([0-9]+)$'
,
views
.
inventory_process_state
),
url
(
r'^inventory_process_state/([0-9]+)$'
,
views
.
inventory_process_state
),
url
(
r'^all/?([a-z]*)$'
,
views
.
all
),
url
(
r'^all/?([a-z]*)$'
,
views
.
all
),
url
(
r'^get_shelves_extra_data$'
,
views
.
get_shelves_extra_data
),
url
(
r'^change_products_shelfs$'
,
views
.
change_products_shelfs
),
url
(
r'^change_products_shelfs$'
,
views
.
change_products_shelfs
),
url
(
r'^(?P<shelf_id>\d+)$'
,
views
.
shelf_data
),
url
(
r'^(?P<shelf_id>\d+)$'
,
views
.
shelf_data
),
url
(
r'^(?P<shelf_id>\d+)/products$'
,
views
.
products
),
url
(
r'^(?P<shelf_id>\d+)/products$'
,
views
.
products
),
...
...
shelfs/views.py
View file @
560b2c07
...
@@ -13,8 +13,6 @@ def index(request):
...
@@ -13,8 +13,6 @@ def index(request):
"""Main shelf page"""
"""Main shelf page"""
shelfs
=
Shelfs
.
get_all
()
shelfs
=
Shelfs
.
get_all
()
# TODO : Make the distinction beetween active and inactive products
# TODO : Make the distinction beetween active and inactive products
for
s
in
shelfs
:
s
[
'shelf_value'
]
=
-
1
context
=
{
'title'
:
'Rayons'
,
context
=
{
'title'
:
'Rayons'
,
'shelfs'
:
json
.
dumps
(
shelfs
)}
'shelfs'
:
json
.
dumps
(
shelfs
)}
...
@@ -85,25 +83,6 @@ def all(request, precision):
...
@@ -85,25 +83,6 @@ def all(request, precision):
"""Get all shelves data"""
"""Get all shelves data"""
return
JsonResponse
({
'res'
:
Shelfs
.
get_all
(
precision
)})
return
JsonResponse
({
'res'
:
Shelfs
.
get_all
(
precision
)})
def
get_shelves_extra_data
(
request
):
"""Get data that need calculation, so long execution time"""
shelfs
=
Shelfs
.
get_all
()
res
=
[]
for
s
in
shelfs
:
shelf_products
=
Shelf
(
s
[
'id'
])
.
get_products
()[
'data'
]
shelf_value
=
0
for
p
in
shelf_products
:
shelf_value
+=
float
(
p
[
'qty_available'
])
*
float
(
p
[
'standard_price'
])
res
.
append
({
'id'
:
s
[
'id'
],
'shelf_value'
:
round
(
shelf_value
,
2
)
})
return
JsonResponse
({
'res'
:
res
})
def
products
(
request
,
shelf_id
):
def
products
(
request
,
shelf_id
):
"""Get all products from a shelf"""
"""Get all products from a shelf"""
res
=
{}
res
=
{}
...
...
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