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
88bbcc8e
Commit
88bbcc8e
authored
Jul 05, 2021
by
Alexis Aoun
2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
controle de l'input et fix des warnings de lint
parent
ae99c34c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
20 deletions
+23
-20
reception_produits.js
reception/static/js/reception_produits.js
+22
-19
reception_produits.html
templates/reception/reception_produits.html
+1
-1
No files found.
reception/static/js/reception_produits.js
View file @
88bbcc8e
...
@@ -69,6 +69,7 @@ function select_product_from_bc(barcode) {
...
@@ -69,6 +69,7 @@ function select_product_from_bc(barcode) {
try
{
try
{
if
(
editing_product
==
null
)
{
if
(
editing_product
==
null
)
{
var
scannedProduct
=
barcodes
.
get_corresponding_odoo_product
(
barcode
);
var
scannedProduct
=
barcodes
.
get_corresponding_odoo_product
(
barcode
);
priceToWeightIsCorrect
=
true
;
priceToWeightIsCorrect
=
true
;
if
(
scannedProduct
==
null
)
{
if
(
scannedProduct
==
null
)
{
...
@@ -95,26 +96,24 @@ function select_product_from_bc(barcode) {
...
@@ -95,26 +96,24 @@ function select_product_from_bc(barcode) {
});
});
}
}
if
(
foundProduct
.
data
!==
null
)
{
if
(
foundProduct
.
data
!==
null
)
{
if
(
scannedProduct
.
rule
===
'weight'
)
{
if
(
scannedProduct
.
rule
===
'weight'
)
{
foundProduct
.
data
.
product_qty
=
scannedProduct
.
qty
;
foundProduct
.
data
.
product_qty
=
scannedProduct
.
qty
;
}
}
else
if
(
scannedProduct
.
rule
===
'price_to_weight'
)
{
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
));
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
);
setupPopUpBtnStyle
(
scannedProduct
);
}
}
if
(
scannedProduct
.
rule
!==
'price_to_weight'
)
{
if
(
scannedProduct
.
rule
!==
'price_to_weight'
)
{
if
(
scannedProduct
.
rule
===
'weight'
)
{
if
(
scannedProduct
.
rule
===
'weight'
)
{
editProductInfo
(
foundProduct
.
data
,
foundProduct
.
data
.
product_qty
);
editProductInfo
(
foundProduct
.
data
,
foundProduct
.
data
.
product_qty
);
}
}
else
{
else
{
setLineEdition
(
foundProduct
.
data
);
setLineEdition
(
foundProduct
.
data
);
}
}
if
(
foundProduct
.
place
===
'to_process'
)
{
if
(
foundProduct
.
place
===
'to_process'
)
{
let
row
=
table_to_process
.
row
(
$
(
'#'
+
foundProduct
.
data
.
product_id
[
0
]));
let
row
=
table_to_process
.
row
(
$
(
'#'
+
foundProduct
.
data
.
product_id
[
0
]));
remove_from_toProcess
(
row
,
foundProduct
.
data
);
remove_from_toProcess
(
row
,
foundProduct
.
data
);
}
}
}
}
...
@@ -174,35 +173,39 @@ function update_distant_orders() {
...
@@ -174,35 +173,39 @@ function update_distant_orders() {
});
});
}
}
function
price_to_weight_confirmed_callback
(
foundProduct
,
scannedProduct
){
function
price_to_weight_confirmed_callback
(
foundProduct
,
scannedProduct
)
{
return
function
price_to_weight_confirmed
(){
return
function
price_to_weight_confirmed
()
{
if
(
priceToWeightIsCorrect
)
{
if
(
priceToWeightIsCorrect
)
{
foundProduct
.
data
.
product_qty
=
scannedProduct
.
qty
;
foundProduct
.
data
.
product_qty
=
scannedProduct
.
qty
;
}
}
else
{
else
{
//TODO il n'y a aucun controle sur l'input à corriger
//TODO il n'y a aucun controle sur l'input à corriger
foundProduct
.
data
.
product_qty
=
Number
((
scannedProduct
.
value
/
document
.
getElementById
(
"new_price_to_weight"
).
value
).
toFixed
(
3
));
var
tmp
=
Number
((
scannedProduct
.
value
/
document
.
getElementById
(
"new_price_to_weight"
).
value
).
toFixed
(
3
));
if
(
isFinite
(
tmp
))
{
foundProduct
.
data
.
product_qty
=
tmp
;
}
}
}
if
(
foundProduct
.
data
!==
null
)
{
if
(
foundProduct
.
data
!==
null
&&
isFinite
(
tmp
)
)
{
editProductInfo
(
foundProduct
.
data
,
foundProduct
.
data
.
product_qty
);
editProductInfo
(
foundProduct
.
data
,
foundProduct
.
data
.
product_qty
);
if
(
foundProduct
.
place
===
'to_process'
)
{
if
(
foundProduct
.
place
===
'to_process'
)
{
let
row
=
table_to_process
.
row
(
$
(
'#'
+
foundProduct
.
data
.
product_id
[
0
]));
let
row
=
table_to_process
.
row
(
$
(
'#'
+
foundProduct
.
data
.
product_id
[
0
]));
remove_from_toProcess
(
row
,
foundProduct
.
data
);
remove_from_toProcess
(
row
,
foundProduct
.
data
);
}
}
resetPopUpButtons
();
resetPopUpButtons
();
}
}
}
}
;
}
}
function
price_to_weight_is_wrong
(){
function
price_to_weight_is_wrong
()
{
document
.
getElementById
(
"new_price_to_weight"
).
style
.
display
=
""
;
document
.
getElementById
(
"new_price_to_weight"
).
style
.
display
=
""
;
document
.
getElementsByClassName
(
"btn--success"
)[
0
].
style
.
display
=
"none"
;
document
.
getElementsByClassName
(
"btn--success"
)[
0
].
style
.
display
=
"none"
;
document
.
querySelector
(
'#modal_closebtn_bottom'
).
innerHTML
=
'OK'
;
document
.
querySelector
(
'#modal_closebtn_bottom'
).
innerHTML
=
'OK'
;
priceToWeightIsCorrect
=
false
;
priceToWeightIsCorrect
=
false
;
}
}
function
setupPopUpBtnStyle
(
p
){
function
setupPopUpBtnStyle
(
p
)
{
//On inverse en quelque sorte les boutons succes et d'annulation en mettant "Oui" sur le btn d'annulation
//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.
// et "Non" sur le bouton de reussite.
//Cela nous permet de reecrire moins de code puisque si la reponse est Oui on ne veut
//Cela nous permet de reecrire moins de code puisque si la reponse est Oui on ne veut
...
...
templates/reception/reception_produits.html
View file @
88bbcc8e
...
@@ -181,7 +181,7 @@
...
@@ -181,7 +181,7 @@
<h3>
Confirmation du prix
</h3>
<h3>
Confirmation du prix
</h3>
<p>
Est ce que le prix au kilo du produit
<b><span
id=
"product_to_verify"
></span></b>
<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>
est bien
<b><span
id=
"price_to_verify"
></span></b>
euros/Kg ?
</p>
<
textarea
name=
"Prix au Kilo"
id=
"new_price_to_weight"
cols=
"3"
rows=
"1"
></textarea
>
<
input
type=
"number"
min=
"0.00001"
name=
"Prix au Kilo"
id=
"new_price_to_weight"
>
</div>
</div>
</div>
</div>
<br/>
<br/>
...
...
Damien Moulard
@DamienM
mentioned in commit
1835290c
Jan 17, 2022
mentioned in commit
1835290c
mentioned in commit 1835290c2a6ff23629dd84d8d34ae2c61cb8406d
Toggle commit list
Damien Moulard
@DamienM
mentioned in merge request
!105 (merged)
Jan 17, 2022
mentioned in merge request
!105 (merged)
mentioned in merge request !105
Toggle commit list
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