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
1988c674
Commit
1988c674
authored
Jul 02, 2021
by
Alexis Aoun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor et renommage de variable
parent
da42e4c6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
35 deletions
+22
-35
reception_produits.js
reception/static/js/reception_produits.js
+22
-35
No files found.
reception/static/js/reception_produits.js
View file @
1988c674
...
@@ -68,64 +68,51 @@ function searchUpdatedProduct() {
...
@@ -68,64 +68,51 @@ function searchUpdatedProduct() {
function
select_product_from_bc
(
barcode
)
{
function
select_product_from_bc
(
barcode
)
{
try
{
try
{
if
(
editing_product
==
null
)
{
if
(
editing_product
==
null
)
{
var
p
=
barcodes
.
get_corresponding_odoo_product
(
barcode
);
var
scannedProduct
=
barcodes
.
get_corresponding_odoo_product
(
barcode
);
var
qtyIsWeight
=
false
;
var
qtyIsPriceToWeight
=
false
;
priceToWeightIsCorrect
=
true
;
priceToWeightIsCorrect
=
true
;
console
.
log
(
p
);
if
(
scannedProduct
==
null
)
{
if
(
p
==
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
foundProduct
=
{
data
:
null
,
place
:
null
};
console
.
log
(
p
.
rule
);
if
(
p
.
rule
==
'weight'
)
qtyIsWeight
=
true
;
else
if
(
p
.
rule
==
'price_to_weight'
)
qtyIsPriceToWeight
=
true
;
$
.
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
));
found
Product
.
data
=
JSON
.
parse
(
JSON
.
stringify
(
e
));
found
.
place
=
'processed'
;
found
Product
.
place
=
'processed'
;
}
}
});
});
}
}
if
(
qtyIsWeight
)
if
(
scannedProduct
.
rule
==
'weight'
)
found
.
data
.
product_qty
=
p
.
qty
;
found
Product
.
data
.
product_qty
=
scannedProduct
.
qty
;
else
if
(
qtyIsPriceToWeight
){
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
(
found
,
p
));
openModal
(
$
(
'#templates #modal_confirm_price_to_weight'
).
html
(),
price_to_weight_is_wrong
,
'Non'
,
false
,
true
,
price_to_weight_confirmed_callback
(
found
Product
,
scannedProduct
));
setupPopUpBtnStyle
(
p
);
setupPopUpBtnStyle
(
scannedProduct
);
}
}
if
(
found
.
data
!==
null
&&
!
qtyIsPriceToWeight
){
if
(
found
Product
.
data
!==
null
&&
!
(
scannedProduct
.
rule
==
'price_to_weight'
)
){
if
(
qtyIsWeight
)
if
(
scannedProduct
.
rule
==
'weight'
)
editProductInfo
(
found
.
data
,
found
.
data
.
product_qty
);
editProductInfo
(
found
Product
.
data
,
foundProduct
.
data
.
product_qty
);
else
else
setLineEdition
(
found
.
data
);
setLineEdition
(
found
Product
.
data
);
if
(
found
.
place
===
'to_process'
)
{
if
(
foundProduct
.
place
===
'to_process'
)
{
let
row
=
table_to_process
.
row
(
$
(
'#'
+
found
.
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
,
found
.
data
);
}
}
}
}
}
}
...
...
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