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
e75db440
Commit
e75db440
authored
Mar 19, 2025
by
François COLOMBIER
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '7848-cannot-validate-qty-with-decimal-on-kg-product' into migration-v12
parents
f2dff3c8
ccbaf420
Pipeline
#4187
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
6 deletions
+16
-6
reception_produits.js
reception/static/js/reception_produits.js
+16
-6
No files found.
reception/static/js/reception_produits.js
View file @
e75db440
...
@@ -44,6 +44,16 @@ let lastKeypressTime = 0;
...
@@ -44,6 +44,16 @@ let lastKeypressTime = 0;
/* UTILS */
/* UTILS */
function
is_product_measured_by_unit
(
product
)
{
//Be robust to different possible given names
return
product
.
product_uom
[
1
].
startsWith
(
'Unit'
);
}
function
is_product_measured_in_kg
(
product
)
{
//Be robust to different possible given names
return
product
.
product_uom
[
1
]
==
'kg'
;
}
function
back
()
{
function
back
()
{
document
.
location
.
href
=
"/reception"
;
document
.
location
.
href
=
"/reception"
;
}
}
...
@@ -129,7 +139,7 @@ function select_product_from_bc(barcode) {
...
@@ -129,7 +139,7 @@ function select_product_from_bc(barcode) {
}
}
if
(
foundProduct
.
data
!==
null
)
{
if
(
foundProduct
.
data
!==
null
)
{
if
(
foundProduct
.
data
.
product_uom
[
0
]
==
21
)
{
//if qty is in weight
if
(
is_product_measured_in_kg
(
foundProduct
.
data
)
)
{
//if qty is in weight
if
(
scannedProduct
.
rule
===
'weight'
)
{
if
(
scannedProduct
.
rule
===
'weight'
)
{
editing_product
=
foundProduct
.
data
;
editing_product
=
foundProduct
.
data
;
foundProduct
.
weightAddition
=
true
;
// product weight is directly added
foundProduct
.
weightAddition
=
true
;
// product weight is directly added
...
@@ -142,7 +152,7 @@ function select_product_from_bc(barcode) {
...
@@ -142,7 +152,7 @@ function select_product_from_bc(barcode) {
}
}
if
(
scannedProduct
.
rule
!==
'price_to_weight'
)
{
if
(
scannedProduct
.
rule
!==
'price_to_weight'
)
{
if
(
foundProduct
.
data
.
product_uom
[
0
]
!=
21
)
{
if
(
!
is_product_measured_in_kg
(
foundProduct
.
data
)
)
{
setLineEdition
(
foundProduct
.
data
);
setLineEdition
(
foundProduct
.
data
);
}
}
...
@@ -1222,7 +1232,7 @@ function setLineEdition(product) {
...
@@ -1222,7 +1232,7 @@ function setLineEdition(product) {
document
.
getElementById
(
"edition_input"
).
focus
();
document
.
getElementById
(
"edition_input"
).
focus
();
// uom
// uom
if
(
editing_product
.
product_uom
[
0
]
==
1
)
{
// Unit
if
(
is_product_measured_by_unit
(
editing_product
)
)
{
// Unit
if
(
reception_status
==
'False'
||
re_editing_qty
===
true
)
{
if
(
reception_status
==
'False'
||
re_editing_qty
===
true
)
{
document
.
getElementById
(
'product_uom'
).
innerHTML
=
' unité(s)'
;
document
.
getElementById
(
'product_uom'
).
innerHTML
=
' unité(s)'
;
$
(
'#edition_input'
).
attr
(
'type'
,
'number'
)
$
(
'#edition_input'
).
attr
(
'type'
,
'number'
)
...
@@ -1234,7 +1244,7 @@ function setLineEdition(product) {
...
@@ -1234,7 +1244,7 @@ function setLineEdition(product) {
.
attr
(
'step'
,
(
allow_four_digits_in_reception_price
==
"True"
?
0.0001
:
0.01
))
.
attr
(
'step'
,
(
allow_four_digits_in_reception_price
==
"True"
?
0.0001
:
0.01
))
.
attr
(
'max'
,
9999
);
.
attr
(
'max'
,
9999
);
}
}
}
else
if
(
editing_product
.
product_uom
[
0
]
==
21
)
{
// kg
}
else
if
(
is_product_measured_in_kg
(
editing_product
)
)
{
// kg
if
(
reception_status
==
'False'
||
re_editing_qty
===
true
)
{
if
(
reception_status
==
'False'
||
re_editing_qty
===
true
)
{
document
.
getElementById
(
'product_uom'
).
innerHTML
=
' kg'
;
document
.
getElementById
(
'product_uom'
).
innerHTML
=
' kg'
;
$
(
'#edition_input'
).
attr
(
'type'
,
'number'
)
$
(
'#edition_input'
).
attr
(
'type'
,
'number'
)
...
@@ -1712,7 +1722,7 @@ function send(given_products = []) {
...
@@ -1712,7 +1722,7 @@ function send(given_products = []) {
}
}
}
}
if
(
product_copy
.
product_uom
[
0
]
==
21
&&
products_to_update
[
i
].
product_qty
>
0.1
)
{
// kg
if
(
is_product_measured_in_kg
(
product_copy
)
&&
products_to_update
[
i
].
product_qty
>
0.1
)
{
// kg
// Add minimum qty in other orders
// Add minimum qty in other orders
product_copy
.
product_qty_package
=
1
;
product_copy
.
product_qty_package
=
1
;
product_copy
.
package_qty
=
0.1
;
product_copy
.
package_qty
=
0.1
;
...
@@ -1721,7 +1731,7 @@ function send(given_products = []) {
...
@@ -1721,7 +1731,7 @@ function send(given_products = []) {
// Remove this qty from first order
// Remove this qty from first order
products_to_update
[
i
].
package_qty
-=
0.1
;
products_to_update
[
i
].
package_qty
-=
0.1
;
products_to_update
[
i
].
product_qty
-=
0.1
;
products_to_update
[
i
].
product_qty
-=
0.1
;
}
else
if
(
product_copy
.
product_uom
[
0
]
==
1
&&
products_to_update
[
i
].
product_qty
>
1
)
{
// Unit
}
else
if
(
is_product_measured_by_unit
(
product_copy
)
&&
products_to_update
[
i
].
product_qty
>
1
)
{
// Unit
product_copy
.
product_qty_package
=
1
;
product_copy
.
product_qty_package
=
1
;
product_copy
.
package_qty
=
1
;
product_copy
.
package_qty
=
1
;
product_copy
.
product_qty
=
1
;
product_copy
.
product_qty
=
1
;
...
...
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