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
30088156
Commit
30088156
authored
Jun 25, 2021
by
Alexis Aoun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correction d une erreur de lint et arrondissement des nombres au centieme
parent
18d6f8ba
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
32 deletions
+35
-32
reception_produits.js
reception/static/js/reception_produits.js
+34
-31
reception_produits.html
templates/reception/reception_produits.html
+1
-1
No files found.
reception/static/js/reception_produits.js
View file @
30088156
...
...
@@ -30,7 +30,10 @@ var reception_status = null,
updatedProducts
=
[],
// Keep record of updated products
validProducts
=
[],
// Keep record of directly validated products
updateType
=
""
,
// step 1: qty_valid; step2: br_valid
barcodes
=
null
;
// Barcodes stored locally
barcodes
=
null
,
// Barcodes stored locally
priceToWeightIsCorrect
=
true
,
found
=
{
data
:
null
,
place
:
null
},
p
=
null
;
var
dbc
=
null
,
sync
=
null
,
...
...
@@ -67,11 +70,11 @@ function searchUpdatedProduct() {
function
select_product_from_bc
(
barcode
)
{
try
{
if
(
editing_product
==
null
)
{
let
p
=
barcodes
.
get_corresponding_odoo_product
(
barcode
);
p
=
barcodes
.
get_corresponding_odoo_product
(
barcode
);
var
qtyIsWeight
=
false
;
var
qtyIsPriceToWeight
=
false
;
var
priceToWeightIsCorrect
=
true
;
priceToWeightIsCorrect
=
true
;
found
=
{
data
:
null
,
place
:
null
};
console
.
log
(
p
);
...
...
@@ -88,7 +91,6 @@ function select_product_from_bc(barcode) {
else
if
(
p
.
rule
==
'price_to_weight'
)
qtyIsPriceToWeight
=
true
;
var
found
=
{
data
:
null
,
place
:
null
};
$
.
each
(
list_to_process
,
function
(
i
,
e
)
{
if
(
e
.
product_id
[
0
]
==
p
.
data
[
barcodes
[
'keys'
][
'id'
]])
{
...
...
@@ -129,31 +131,6 @@ function select_product_from_bc(barcode) {
document
.
getElementsByClassName
(
"btn--success"
)[
0
].
style
.
display
=
""
;
}
//TODO not the cleanest way to manage the callback, needs improvement
//TODO too much repeating code, needs refactor
function
price_to_weight_confirmed
(){
console
.
log
(
"confirming"
)
if
(
priceToWeightIsCorrect
)
found
.
data
.
product_qty
=
p
.
qty
;
else
found
.
data
.
product_qty
=
p
.
value
/
document
.
getElementById
(
"new_price_to_weight"
).
value
;
if
(
found
.
data
!==
null
)
{
setLineEdition
(
found
.
data
);
if
(
found
.
place
===
'to_process'
)
{
let
row
=
table_to_process
.
row
(
$
(
'#'
+
found
.
data
.
product_id
[
0
]));
remove_from_toProcess
(
row
,
found
.
data
);
}
}
}
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
;
}
if
(
found
.
data
!==
null
&&
!
qtyIsPriceToWeight
)
{
setLineEdition
(
found
.
data
);
...
...
@@ -218,6 +195,32 @@ function update_distant_orders() {
});
}
//TODO not the cleanest way to manage the callback, needs improvement
//TODO too much repeating code, needs refactor
function
price_to_weight_confirmed
(){
console
.
log
(
"confirming"
)
if
(
priceToWeightIsCorrect
)
found
.
data
.
product_qty
=
p
.
qty
;
else
found
.
data
.
product_qty
=
(
p
.
value
/
document
.
getElementById
(
"new_price_to_weight"
).
value
).
toFixed
(
2
);
if
(
found
.
data
!==
null
)
{
setLineEdition
(
found
.
data
);
if
(
found
.
place
===
'to_process'
)
{
let
row
=
table_to_process
.
row
(
$
(
'#'
+
found
.
data
.
product_id
[
0
]));
remove_from_toProcess
(
row
,
found
.
data
);
}
}
}
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
;
}
/* INIT */
// Get order(s) data from server
...
...
@@ -934,7 +937,7 @@ function editProductInfo (productToEdit, value = null, batch = false) {
if
(
e
.
product_id
[
0
]
==
productToEdit
.
product_id
[
0
])
{
addition
=
true
;
productToEdit
=
e
;
newValue
=
newValue
+
productToEdit
.
product_qty
;
newValue
=
(
newValue
+
productToEdit
.
product_qty
).
toFixed
(
2
)
;
}
});
// If qty edition & Check if qty changed
...
...
templates/reception/reception_produits.html
View file @
30088156
...
...
@@ -181,7 +181,7 @@
<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>
<textarea
name=
"Prix au Kilo"
id=
"new_price_to_weight"
cols=
"3
0
"
rows=
"1"
></textarea>
<textarea
name=
"Prix au Kilo"
id=
"new_price_to_weight"
cols=
"3"
rows=
"1"
></textarea>
</div>
</div>
<br/>
...
...
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