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
dd9a4bf5
Commit
dd9a4bf5
authored
Jun 28, 2021
by
Alexis Aoun
2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug de type pour les poids et refactor de callback de confirmation
parent
30088156
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
19 deletions
+24
-19
reception_produits.js
reception/static/js/reception_produits.js
+24
-19
No files found.
reception/static/js/reception_produits.js
View file @
dd9a4bf5
...
@@ -31,9 +31,7 @@ var reception_status = null,
...
@@ -31,9 +31,7 @@ var reception_status = null,
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
,
priceToWeightIsCorrect
=
true
;
found
=
{
data
:
null
,
place
:
null
},
p
=
null
;
var
dbc
=
null
,
var
dbc
=
null
,
sync
=
null
,
sync
=
null
,
...
@@ -70,11 +68,10 @@ function searchUpdatedProduct() {
...
@@ -70,11 +68,10 @@ function searchUpdatedProduct() {
function
select_product_from_bc
(
barcode
)
{
function
select_product_from_bc
(
barcode
)
{
try
{
try
{
if
(
editing_product
==
null
)
{
if
(
editing_product
==
null
)
{
p
=
barcodes
.
get_corresponding_odoo_product
(
barcode
);
var
p
=
barcodes
.
get_corresponding_odoo_product
(
barcode
);
var
qtyIsWeight
=
false
;
var
qtyIsWeight
=
false
;
var
qtyIsPriceToWeight
=
false
;
var
qtyIsPriceToWeight
=
false
;
priceToWeightIsCorrect
=
true
;
priceToWeightIsCorrect
=
true
;
found
=
{
data
:
null
,
place
:
null
};
console
.
log
(
p
);
console
.
log
(
p
);
...
@@ -84,6 +81,8 @@ function select_product_from_bc(barcode) {
...
@@ -84,6 +81,8 @@ function select_product_from_bc(barcode) {
return
-
1
;
return
-
1
;
}
}
var
found
=
{
data
:
null
,
place
:
null
};
console
.
log
(
p
.
rule
);
console
.
log
(
p
.
rule
);
if
(
p
.
rule
==
'weight'
)
if
(
p
.
rule
==
'weight'
)
qtyIsWeight
=
true
;
qtyIsWeight
=
true
;
...
@@ -112,7 +111,7 @@ function select_product_from_bc(barcode) {
...
@@ -112,7 +111,7 @@ function select_product_from_bc(barcode) {
found
.
data
.
product_qty
=
p
.
qty
;
found
.
data
.
product_qty
=
p
.
qty
;
else
if
(
qtyIsPriceToWeight
){
else
if
(
qtyIsPriceToWeight
){
openModal
(
$
(
'#templates #modal_confirm_price_to_weight'
).
html
(),
price_to_weight_is_wrong
,
'Non'
,
false
,
true
,
price_to_weight_confirmed
);
openModal
(
$
(
'#templates #modal_confirm_price_to_weight'
).
html
(),
price_to_weight_is_wrong
,
'Non'
,
false
,
true
,
price_to_weight_confirmed
_callback
(
found
,
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.
...
@@ -197,23 +196,29 @@ function update_distant_orders() {
...
@@ -197,23 +196,29 @@ function update_distant_orders() {
//TODO not the cleanest way to manage the callback, needs improvement
//TODO not the cleanest way to manage the callback, needs improvement
//TODO too much repeating code, needs refactor
//TODO too much repeating code, needs refactor
function
price_to_weight_confirmed
(){
function
price_to_weight_confirmed_callback
(
found
,
p
){
console
.
log
(
"confirming"
)
if
(
priceToWeightIsCorrect
)
return
function
price_to_weight_confirmed
(){
found
.
data
.
product_qty
=
p
.
qty
;
console
.
log
(
"confirming"
)
else
if
(
priceToWeightIsCorrect
)
found
.
data
.
product_qty
=
(
p
.
value
/
document
.
getElementById
(
"new_price_to_weight"
).
value
).
toFixed
(
2
);
found
.
data
.
product_qty
=
p
.
qty
;
else
found
.
data
.
product_qty
=
Number
((
p
.
value
/
document
.
getElementById
(
"new_price_to_weight"
).
value
).
toFixed
(
2
));
if
(
found
.
data
!==
null
)
{
if
(
found
.
data
!==
null
)
{
setLineEdition
(
found
.
data
);
setLineEdition
(
found
.
data
);
if
(
found
.
place
===
'to_process'
)
{
if
(
found
.
place
===
'to_process'
)
{
let
row
=
table_to_process
.
row
(
$
(
'#'
+
found
.
data
.
product_id
[
0
]));
let
row
=
table_to_process
.
row
(
$
(
'#'
+
found
.
data
.
product_id
[
0
]));
remove_from_toProcess
(
row
,
found
.
data
);
remove_from_toProcess
(
row
,
found
.
data
);
}
}
}
}
}
}
}
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"
;
...
@@ -937,7 +942,7 @@ function editProductInfo (productToEdit, value = null, batch = false) {
...
@@ -937,7 +942,7 @@ function editProductInfo (productToEdit, value = null, batch = false) {
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
).
toFixed
(
2
);
newValue
=
Number
((
newValue
+
productToEdit
.
product_qty
).
toFixed
(
2
)
);
}
}
});
});
// If qty edition & Check if qty changed
// If qty edition & Check if qty changed
...
...
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