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
65c073b6
Commit
65c073b6
authored
Feb 04, 2022
by
Félicie
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin' into 2207-type-of-members
parents
16f87ccd
99ad4563
Pipeline
#1760
failed with stage
in 1 minute 33 seconds
Changes
16
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
218 additions
and
70 deletions
+218
-70
test_url.py
envelops/tests/test_url.py
+0
-7
test_url.py
inventory/tests/test_url.py
+8
-3
test_url.py
members/tests/test_url.py
+8
-3
test_url.py
orders/tests/test_url.py
+8
-3
test_url.py
outils/tests/test_url.py
+0
-7
package.json
package.json
+2
-2
test_url.py
products/tests/test_url.py
+8
-3
reception_produits.js
reception/static/js/reception_produits.js
+138
-20
test_url.py
reception/tests/test_url.py
+8
-3
test_views.py
reception/tests/test_views.py
+0
-0
test_url.py
sales/tests/test_url.py
+8
-3
test_url.py
shelfs/tests/test_url.py
+8
-3
test_url.py
shifts/tests/test_url.py
+0
-7
test_url.py
shop/tests/test_url.py
+8
-3
test_url.py
stock/tests/test_url.py
+8
-3
reception_produits.html
templates/reception/reception_produits.html
+6
-0
No files found.
envelops/tests/test_url.py
View file @
65c073b6
from
django.test
import
SimpleTestCase
class
TestUrls
(
SimpleTestCase
):
def
test_list_url_is_resolved
(
self
):
assert
1
==
1
\ No newline at end of file
inventory/tests/test_url.py
View file @
65c073b6
from
django.test
import
SimpleTestCase
from
django.test
import
SimpleTestCase
from
django.test
import
Client
class
TestUrls
(
SimpleTestCase
):
class
TestUrls
(
SimpleTestCase
):
def
test_list_url_is_resolved
(
self
):
def
testInventoryUrlIsResolved
(
self
):
assert
1
==
1
\ No newline at end of file
c
=
Client
()
response
=
c
.
get
(
'/reception/'
)
assert
response
.
status_code
==
200
,
"Inventory url is not resolved"
members/tests/test_url.py
View file @
65c073b6
from
django.test
import
SimpleTestCase
from
django.test
import
SimpleTestCase
from
django.test
import
Client
class
TestUrls
(
SimpleTestCase
):
class
TestUrls
(
SimpleTestCase
):
def
test_list_url_is_resolved
(
self
):
def
testMembersUrlIsResolved
(
self
):
assert
1
==
1
\ No newline at end of file
c
=
Client
()
response
=
c
.
get
(
'/members/'
)
assert
response
.
status_code
==
200
,
"Members url is not resolved"
orders/tests/test_url.py
View file @
65c073b6
from
django.test
import
SimpleTestCase
from
django.test
import
SimpleTestCase
from
django.test
import
Client
class
TestUrls
(
SimpleTestCase
):
class
TestUrls
(
SimpleTestCase
):
def
test_list_url_is_resolved
(
self
):
def
testOrdersUrlIsResolved
(
self
):
assert
1
==
1
\ No newline at end of file
c
=
Client
()
response
=
c
.
get
(
'/orders/'
)
assert
response
.
status_code
==
200
,
"Orders url is not resolved"
outils/tests/test_url.py
View file @
65c073b6
from
django.test
import
SimpleTestCase
class
TestUrls
(
SimpleTestCase
):
def
test_list_url_is_resolved
(
self
):
assert
1
==
1
\ No newline at end of file
package.json
View file @
65c073b6
...
@@ -9,8 +9,8 @@
...
@@ -9,8 +9,8 @@
},
},
"scripts"
:
{
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
,
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
,
"lint"
:
"eslint . --max-warnings
326
'**/*.js'"
,
"lint"
:
"eslint . --max-warnings
292
'**/*.js'"
,
"lint-fix"
:
"eslint . --fix --max-warnings
326
'**/*.js'"
"lint-fix"
:
"eslint . --fix --max-warnings
292
'**/*.js'"
},
},
"repository"
:
{
"repository"
:
{
"type"
:
"git"
,
"type"
:
"git"
,
...
...
products/tests/test_url.py
View file @
65c073b6
from
django.test
import
SimpleTestCase
from
django.test
import
SimpleTestCase
from
django.test
import
Client
class
TestUrls
(
SimpleTestCase
):
class
TestUrls
(
SimpleTestCase
):
def
test_list_url_is_resolved
(
self
):
def
testProductsUrlIsResolved
(
self
):
assert
1
==
1
\ No newline at end of file
c
=
Client
()
response
=
c
.
get
(
'/products/'
)
assert
response
.
status_code
==
200
,
"Products url is not resolved"
reception/static/js/reception_produits.js
View file @
65c073b6
...
@@ -30,7 +30,8 @@ var reception_status = null,
...
@@ -30,7 +30,8 @@ var reception_status = null,
updatedProducts
=
[],
// Keep record of updated products
updatedProducts
=
[],
// Keep record of updated products
validProducts
=
[],
// Keep record of directly validated products
validProducts
=
[],
// Keep record of directly validated products
updateType
=
""
,
// step 1: qty_valid; step2: br_valid
updateType
=
""
,
// step 1: qty_valid; step2: br_valid
barcodes
=
null
;
// Barcodes stored locally
barcodes
=
null
,
// Barcodes stored locally
priceToWeightIsCorrect
=
true
;
var
dbc
=
null
,
var
dbc
=
null
,
sync
=
null
,
sync
=
null
,
...
@@ -67,38 +68,56 @@ function searchUpdatedProduct() {
...
@@ -67,38 +68,56 @@ function searchUpdatedProduct() {
function
select_product_from_bc
(
barcode
)
{
function
select_product_from_bc
(
barcode
)
{
try
{
try
{
if
(
editing_product
==
null
)
{
if
(
editing_product
==
null
)
{
let
p
=
barcodes
.
get_corresponding_odoo_product
(
barcode
);
var
scannedProduct
=
barcodes
.
get_corresponding_odoo_product
(
barcode
);
if
(
p
==
null
)
{
priceToWeightIsCorrect
=
true
;
if
(
scannedProduct
==
null
)
{
alert
(
"Le code-barre "
+
barcode
+
" ne correspond à aucun article connu."
);
alert
(
"Le code-barre "
+
barcode
+
" ne correspond à aucun article connu."
);
return
-
1
;
return
-
1
;
}
}
var
found
=
{
data
:
null
,
place
:
null
};
var
found
Product
=
{
data
:
null
,
place
:
null
};
$
.
each
(
list_to_process
,
function
(
i
,
e
)
{
$
.
each
(
list_to_process
,
function
(
i
,
e
)
{
if
(
e
.
product_id
[
0
]
==
p
.
data
[
barcodes
[
'keys'
][
'id'
]])
{
if
(
e
.
product_id
[
0
]
==
scannedProduct
.
data
[
barcodes
[
'keys'
][
'id'
]])
{
found
.
data
=
e
;
found
Product
.
data
=
e
;
found
.
place
=
'to_process'
;
found
Product
.
place
=
'to_process'
;
}
}
});
});
if
(
found
.
data
==
null
)
{
if
(
found
Product
.
data
==
null
)
{
$
.
each
(
list_processed
,
function
(
i
,
e
)
{
$
.
each
(
list_processed
,
function
(
i
,
e
)
{
if
(
e
.
product_id
[
0
]
==
p
.
data
[
barcodes
[
'keys'
][
'id'
]])
{
if
(
e
.
product_id
[
0
]
==
scannedProduct
.
data
[
barcodes
[
'keys'
][
'id'
]])
{
found
.
data
=
JSON
.
parse
(
JSON
.
stringify
(
e
));
foundProduct
.
data
=
JSON
.
parse
(
JSON
.
stringify
(
e
));
found
.
place
=
'processed'
;
foundProduct
.
data
.
product_qty
=
null
;
foundProduct
.
place
=
'processed'
;
}
}
});
});
}
}
if
(
found
.
data
!==
null
)
{
if
(
foundProduct
.
data
!==
null
)
{
setLineEdition
(
found
.
data
);
if
(
foundProduct
.
data
.
product_uom
[
0
]
==
21
)
{
//if qty is in weight
if
(
found
.
place
===
'to_process'
)
{
if
(
scannedProduct
.
rule
===
'weight'
)
{
let
row
=
table_to_process
.
row
(
$
(
'#'
+
found
.
data
.
product_id
[
0
]));
editing_product
=
foundProduct
.
data
;
editProductInfo
(
foundProduct
.
data
,
scannedProduct
.
qty
);
editing_product
=
null
;
}
else
if
(
scannedProduct
.
rule
===
'price_to_weight'
)
{
openModal
(
$
(
'#templates #modal_confirm_price_to_weight'
).
html
(),
price_to_weight_is_wrong
,
'Non'
,
false
,
true
,
price_to_weight_confirmed_callback
(
foundProduct
,
scannedProduct
));
setupPopUpBtnStyle
(
scannedProduct
);
}
}
remove_from_toProcess
(
row
,
found
.
data
);
if
(
scannedProduct
.
rule
!==
'price_to_weight'
)
{
if
(
foundProduct
.
data
.
product_uom
[
0
]
!=
21
)
{
setLineEdition
(
foundProduct
.
data
);
}
if
(
foundProduct
.
place
===
'to_process'
)
{
let
row
=
table_to_process
.
row
(
$
(
'#'
+
foundProduct
.
data
.
product_id
[
0
]));
remove_from_toProcess
(
row
,
foundProduct
.
data
);
}
}
}
}
}
}
}
...
@@ -156,6 +175,65 @@ function update_distant_orders() {
...
@@ -156,6 +175,65 @@ function update_distant_orders() {
});
});
}
}
function
price_to_weight_confirmed_callback
(
foundProduct
,
scannedProduct
)
{
return
function
()
{
let
newQty
=
null
;
if
(
priceToWeightIsCorrect
)
{
newQty
=
scannedProduct
.
qty
;
}
else
{
let
tmp
=
Number
((
scannedProduct
.
value
/
document
.
getElementById
(
"new_price_to_weight"
).
value
).
toFixed
(
3
));
if
(
isFinite
(
tmp
))
{
newQty
=
tmp
;
}
}
if
(
foundProduct
.
data
!==
null
&&
newQty
!=
null
)
{
if
(
foundProduct
.
place
===
'to_process'
)
{
let
row
=
table_to_process
.
row
(
$
(
'#'
+
foundProduct
.
data
.
product_id
[
0
]));
remove_from_toProcess
(
row
,
foundProduct
.
data
);
}
editing_product
=
foundProduct
.
data
;
editProductInfo
(
foundProduct
.
data
,
newQty
);
editing_product
=
null
;
resetPopUpButtons
();
}
};
}
function
price_to_weight_is_wrong
()
{
document
.
getElementById
(
"new_price_to_weight"
).
style
.
display
=
""
;
document
.
getElementsByClassName
(
"btn--success"
)[
0
].
style
.
display
=
"none"
;
document
.
querySelector
(
'#modal_closebtn_bottom'
).
innerHTML
=
'OK'
;
priceToWeightIsCorrect
=
false
;
}
function
setupPopUpBtnStyle
(
p
)
{
//On inverse en quelque sorte les boutons succes et d'annulation en mettant "Oui" sur le btn d'annulation
// et "Non" sur le bouton de reussite.
//Cela nous permet de reecrire moins de code puisque si la reponse est Oui on ne veut
//rien modifier et sortir du pop up, ce qui correspond au comportement du bouton annulation
//(ou aussi appeler cancel button)
document
.
querySelector
(
'#modal_closebtn_bottom'
).
innerHTML
=
'Oui'
;
document
.
getElementById
(
"modal_closebtn_bottom"
).
style
.
backgroundColor
=
"green"
;
document
.
getElementsByClassName
(
"btn--success"
)[
0
].
style
.
backgroundColor
=
"red"
;
document
.
querySelector
(
'#product_to_verify'
).
innerHTML
=
p
.
data
[
0
];
document
.
querySelector
(
'#price_to_verify'
).
innerHTML
=
p
.
data
[
6
];
document
.
getElementById
(
"new_price_to_weight"
).
style
.
display
=
"none"
;
document
.
getElementsByClassName
(
"btn--success"
)[
0
].
style
.
display
=
""
;
}
function
resetPopUpButtons
()
{
document
.
getElementsByClassName
(
"btn--success"
)[
0
].
style
.
display
=
""
;
document
.
getElementsByClassName
(
"btn--success"
)[
0
].
style
.
backgroundColor
=
""
;
document
.
querySelector
(
'#modal_closebtn_bottom'
).
style
.
backgroundColor
=
""
;
}
/* INIT */
/* INIT */
// Get order(s) data from server
// Get order(s) data from server
...
@@ -857,26 +935,32 @@ function editProductInfo (productToEdit, value = null, batch = false) {
...
@@ -857,26 +935,32 @@ function editProductInfo (productToEdit, value = null, batch = false) {
// Check if the product is already in the 'updated' list
// Check if the product is already in the 'updated' list
var
index
=
searchUpdatedProduct
();
var
index
=
searchUpdatedProduct
();
var
firstUpdate
=
false
;
var
firstUpdate
=
false
;
var
isValid
=
false
;
let
newValue
=
value
;
let
newValue
=
value
;
var
addition
=
false
;
var
addition
=
false
;
// If 'value' parameter not set, get value from edition input
// If 'value' parameter not set, get value from edition input
if
(
value
==
null
)
{
if
(
value
==
null
)
{
newValue
=
parseFloat
(
document
.
getElementById
(
'edition_input'
).
value
.
replace
(
','
,
'.'
));
newValue
=
parseFloat
(
document
.
getElementById
(
'edition_input'
).
value
.
replace
(
','
,
'.'
));
newValue
=
newValue
.
isFinite
()
?
newValue
:
0
;
}
}
$
.
each
(
list_processed
,
function
(
i
,
e
)
{
$
.
each
(
list_processed
,
function
(
i
,
e
)
{
if
(
e
.
product_id
[
0
]
==
productToEdit
.
product_id
[
0
])
{
if
(
e
.
product_id
[
0
]
==
productToEdit
.
product_id
[
0
])
{
addition
=
true
;
addition
=
true
;
productToEdit
=
e
;
productToEdit
=
e
;
newValue
=
newValue
+
productToEdit
.
product_qty
;
newValue
=
Number
((
newValue
+
productToEdit
.
product_qty
).
toFixed
(
3
))
;
}
}
});
});
// If qty edition & Check if qty changed
// If qty edition & Check if qty changed
if
(
reception_status
==
"False"
&&
productToEdit
.
product_qty
!=
newValue
)
{
if
(
reception_status
==
"False"
)
{
if
(
index
==
-
1
)
{
// First update
firstUpdate
=
(
index
==
-
1
);
//first update
if
(
productToEdit
.
product_qty
!=
newValue
)
{
if
(
firstUpdate
)
{
productToEdit
.
old_qty
=
productToEdit
.
product_qty
;
productToEdit
.
old_qty
=
productToEdit
.
product_qty
;
firstUpdate
=
true
;
}
else
{
//if it is not the first update AND newValue is equal to the validation qty then the product is valid
isValid
=
(
newValue
===
productToEdit
.
old_qty
);
}
}
// Edit product info
// Edit product info
...
@@ -887,6 +971,11 @@ function editProductInfo (productToEdit, value = null, batch = false) {
...
@@ -887,6 +971,11 @@ function editProductInfo (productToEdit, value = null, batch = false) {
*/
*/
productToEdit
.
product_qty_package
=
1
;
productToEdit
.
product_qty_package
=
1
;
productToEdit
.
package_qty
=
productToEdit
.
product_qty
;
productToEdit
.
package_qty
=
productToEdit
.
product_qty
;
}
else
if
(
firstUpdate
)
{
// if the product is updated for the first time and productQty is equal to the newValue then the product is validated
isValid
=
true
;
}
}
}
// Check if price changed
// Check if price changed
...
@@ -920,6 +1009,14 @@ function editProductInfo (productToEdit, value = null, batch = false) {
...
@@ -920,6 +1009,14 @@ function editProductInfo (productToEdit, value = null, batch = false) {
if
(
firstUpdate
)
{
if
(
firstUpdate
)
{
updatedProducts
.
push
(
productToEdit
);
updatedProducts
.
push
(
productToEdit
);
//if product is validated thru edition -> add to valid_products
if
(
isValid
)
{
// Create 'valid_products' list in order if not exists
if
(
!
orders
[
productToEdit
.
id_po
][
'valid_products'
])
{
orders
[
productToEdit
.
id_po
][
'valid_products'
]
=
[];
}
orders
[
productToEdit
.
id_po
][
'valid_products'
].
push
(
productToEdit
[
'id'
]);
}
else
{
// Create 'updated_products' list in order if not exists
// Create 'updated_products' list in order if not exists
if
(
!
orders
[
productToEdit
.
id_po
][
'updated_products'
])
{
if
(
!
orders
[
productToEdit
.
id_po
][
'updated_products'
])
{
orders
[
productToEdit
.
id_po
][
'updated_products'
]
=
[];
orders
[
productToEdit
.
id_po
][
'updated_products'
]
=
[];
...
@@ -935,6 +1032,26 @@ function editProductInfo (productToEdit, value = null, batch = false) {
...
@@ -935,6 +1032,26 @@ function editProductInfo (productToEdit, value = null, batch = false) {
orders
[
productToEdit
.
id_po
][
'valid_products'
].
splice
(
i
,
1
);
orders
[
productToEdit
.
id_po
][
'valid_products'
].
splice
(
i
,
1
);
}
}
}
}
}
}
else
{
if
(
isValid
)
{
//if product is valid -> remove from updated_products list and add to valid_products list
//removing from updated_products
for
(
i
in
orders
[
productToEdit
.
id_po
][
'updated_products'
])
{
if
(
orders
[
productToEdit
.
id_po
][
'updated_products'
][
i
][
'product_id'
][
0
]
==
productToEdit
[
'product_id'
][
0
])
{
orders
[
productToEdit
.
id_po
][
'updated_products'
].
splice
(
i
,
1
);
}
}
//add to valid_products
// Create 'valid_products' list in order if not exists
if
(
!
orders
[
productToEdit
.
id_po
][
'valid_products'
])
{
orders
[
productToEdit
.
id_po
][
'valid_products'
]
=
[];
}
orders
[
productToEdit
.
id_po
][
'valid_products'
].
push
(
productToEdit
[
'id'
]);
}
else
{
}
else
{
// Look for product in order's updated products list
// Look for product in order's updated products list
for
(
i
in
orders
[
productToEdit
.
id_po
][
'updated_products'
])
{
for
(
i
in
orders
[
productToEdit
.
id_po
][
'updated_products'
])
{
...
@@ -944,6 +1061,7 @@ function editProductInfo (productToEdit, value = null, batch = false) {
...
@@ -944,6 +1061,7 @@ function editProductInfo (productToEdit, value = null, batch = false) {
}
}
}
}
}
}
}
if
(
batch
===
false
)
{
if
(
batch
===
false
)
{
// Update product order
// Update product order
...
...
reception/tests/test_url.py
View file @
65c073b6
from
django.test
import
SimpleTestCase
from
django.test
import
SimpleTestCase
from
django.test
import
Client
class
TestUrls
(
SimpleTestCase
):
class
TestUrls
(
SimpleTestCase
):
def
test_list_url_is_resolved
(
self
):
def
testReceptionUrlIsResolved
(
self
):
assert
1
==
1
\ No newline at end of file
c
=
Client
()
response
=
c
.
get
(
'/reception/'
)
assert
response
.
status_code
==
200
,
"Reception url is not resolved"
reception/tests/test_views.py
View file @
65c073b6
sales/tests/test_url.py
View file @
65c073b6
from
django.test
import
SimpleTestCase
from
django.test
import
SimpleTestCase
from
django.test
import
Client
class
TestUrls
(
SimpleTestCase
):
class
TestUrls
(
SimpleTestCase
):
def
test_list_url_is_resolved
(
self
):
def
testSalesUrlIsResolved
(
self
):
assert
1
==
1
\ No newline at end of file
c
=
Client
()
response
=
c
.
get
(
'/sales/'
)
assert
response
.
status_code
==
200
,
"Sales url is not resolved"
shelfs/tests/test_url.py
View file @
65c073b6
from
django.test
import
SimpleTestCase
from
django.test
import
SimpleTestCase
from
django.test
import
Client
class
TestUrls
(
SimpleTestCase
):
class
TestUrls
(
SimpleTestCase
):
def
test_list_url_is_resolved
(
self
):
def
testShelfsUrlIsResolved
(
self
):
assert
1
==
1
\ No newline at end of file
c
=
Client
()
response
=
c
.
get
(
'/shelfs/'
)
assert
response
.
status_code
==
200
,
"Shelfs url is not resolved"
shifts/tests/test_url.py
View file @
65c073b6
from
django.test
import
SimpleTestCase
class
TestUrls
(
SimpleTestCase
):
def
test_list_url_is_resolved
(
self
):
assert
1
==
1
\ No newline at end of file
shop/tests/test_url.py
View file @
65c073b6
from
django.test
import
SimpleTestCase
from
django.test
import
SimpleTestCase
from
django.test
import
Client
class
TestUrls
(
SimpleTestCase
):
class
TestUrls
(
SimpleTestCase
):
def
test_list_url_is_resolved
(
self
):
def
testShopUrlIsResolved
(
self
):
assert
1
==
1
\ No newline at end of file
c
=
Client
()
response
=
c
.
get
(
'/shop/'
)
assert
response
.
status_code
==
200
,
"Shop url is not resolved"
stock/tests/test_url.py
View file @
65c073b6
from
django.test
import
SimpleTestCase
from
django.test
import
SimpleTestCase
from
django.test
import
Client
class
TestUrls
(
SimpleTestCase
):
class
TestUrls
(
SimpleTestCase
):
def
test_list_url_is_resolved
(
self
):
def
testStockUrlIsResolved
(
self
):
assert
1
==
1
\ No newline at end of file
c
=
Client
()
response
=
c
.
get
(
'/stock/'
)
assert
response
.
status_code
==
200
,
"Stock url is not resolved"
templates/reception/reception_produits.html
View file @
65c073b6
...
@@ -177,6 +177,12 @@
...
@@ -177,6 +177,12 @@
<div
id=
"modal_FAQ_content"
></div>
<div
id=
"modal_FAQ_content"
></div>
<div
id=
"modal_qtiesValidated"
></div>
<div
id=
"modal_qtiesValidated"
></div>
<div
id=
"modal_pricesValidated"
></div>
<div
id=
"modal_pricesValidated"
></div>
<div
id=
"modal_confirm_price_to_weight"
>
<h3>
Confirmation du prix
</h3>
<p>
Est ce que le prix au kilo du produit
<b><span
id=
"product_to_verify"
></span></b>
est bien
<b><span
id=
"price_to_verify"
></span></b>
euros/Kg ?
</p>
<input
type=
"number"
name=
"Prix au Kilo"
id=
"new_price_to_weight"
>
</div>
</div>
</div>
<br/>
<br/>
</div>
</div>
...
...
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