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
30088156
Commit
30088156
authored
Jun 25, 2021
by
Alexis Aoun
2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correction d une erreur de lint et arrondissement des nombres au centieme
parent
18d6f8ba
Show 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,
...
@@ -30,7 +30,10 @@ 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
,
found
=
{
data
:
null
,
place
:
null
},
p
=
null
;
var
dbc
=
null
,
var
dbc
=
null
,
sync
=
null
,
sync
=
null
,
...
@@ -67,11 +70,11 @@ function searchUpdatedProduct() {
...
@@ -67,11 +70,11 @@ 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
);
p
=
barcodes
.
get_corresponding_odoo_product
(
barcode
);
var
qtyIsWeight
=
false
;
var
qtyIsWeight
=
false
;
var
qtyIsPriceToWeight
=
false
;
var
qtyIsPriceToWeight
=
false
;
var
priceToWeightIsCorrect
=
true
;
priceToWeightIsCorrect
=
true
;
found
=
{
data
:
null
,
place
:
null
};
console
.
log
(
p
);
console
.
log
(
p
);
...
@@ -88,7 +91,6 @@ function select_product_from_bc(barcode) {
...
@@ -88,7 +91,6 @@ function select_product_from_bc(barcode) {
else
if
(
p
.
rule
==
'price_to_weight'
)
else
if
(
p
.
rule
==
'price_to_weight'
)
qtyIsPriceToWeight
=
true
;
qtyIsPriceToWeight
=
true
;
var
found
=
{
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
]
==
p
.
data
[
barcodes
[
'keys'
][
'id'
]])
{
...
@@ -129,31 +131,6 @@ function select_product_from_bc(barcode) {
...
@@ -129,31 +131,6 @@ function select_product_from_bc(barcode) {
document
.
getElementsByClassName
(
"btn--success"
)[
0
].
style
.
display
=
""
;
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
)
{
if
(
found
.
data
!==
null
&&
!
qtyIsPriceToWeight
)
{
setLineEdition
(
found
.
data
);
setLineEdition
(
found
.
data
);
...
@@ -218,6 +195,32 @@ function update_distant_orders() {
...
@@ -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 */
/* INIT */
// Get order(s) data from server
// Get order(s) data from server
...
@@ -934,7 +937,7 @@ function editProductInfo (productToEdit, value = null, batch = false) {
...
@@ -934,7 +937,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
;
newValue
=
(
newValue
+
productToEdit
.
product_qty
).
toFixed
(
2
)
;
}
}
});
});
// If qty edition & Check if qty changed
// If qty edition & Check if qty changed
...
...
templates/reception/reception_produits.html
View file @
30088156
...
@@ -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
0
"
rows=
"1"
></textarea>
<textarea
name=
"Prix au Kilo"
id=
"new_price_to_weight"
cols=
"3"
rows=
"1"
></textarea>
</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