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
de1e3940
Commit
de1e3940
authored
Sep 22, 2023
by
Yvon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
meet new specs for normal barcodes while keeping existing special barcode logic
parent
97a032e3
Pipeline
#2982
failed with stage
in 1 minute 6 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
8 deletions
+41
-8
reception_produits.js
reception/static/js/reception_produits.js
+41
-8
No files found.
reception/static/js/reception_produits.js
View file @
de1e3940
...
...
@@ -100,17 +100,25 @@ function select_product_from_bc(barcode) {
priceToWeightIsCorrect
=
true
;
if
(
scannedProduct
==
null
)
{
alert
(
"Le code-barre "
+
barcode
+
" ne correspond à aucun article connu."
);
alert
(
"Article introuvable.
\
n"
+
"Le code barre "
+
barcode
+
" n'est associé à aucun article."
+
" Mettez ce produit de côté et prévenez un salarié.
\
n"
+
"ATTENTION : A la fin de la réception, ne validez pas tant que ce colis n'a pas été ajouté par le salarié.e."
);
return
-
1
;
}
var
foundProduct
=
{
data
:
null
,
place
:
null
};
var
qtyOfProcessedProduct
=
null
;
var
product_id
=
null
;
// Does the product come from to_process ?
$
.
each
(
list_to_process
,
function
(
i
,
e
)
{
if
(
e
.
product_id
[
0
]
==
scannedProduct
.
data
[
barcodes
[
'keys'
][
'id'
]])
{
foundProduct
.
data
=
e
;
product_id
=
e
.
product_id
[
0
];
foundProduct
.
place
=
'to_process'
;
}
});
...
...
@@ -120,6 +128,8 @@ function select_product_from_bc(barcode) {
$
.
each
(
list_processed
,
function
(
i
,
e
)
{
if
(
e
.
product_id
[
0
]
==
scannedProduct
.
data
[
barcodes
[
'keys'
][
'id'
]])
{
foundProduct
.
data
=
JSON
.
parse
(
JSON
.
stringify
(
e
));
qtyOfProcessedProduct
=
foundProduct
.
data
.
product_qty
;
product_id
=
e
.
product_id
[
0
];
foundProduct
.
data
.
product_qty
=
null
;
// Set qty to null from product already scanned
foundProduct
.
place
=
'processed'
;
}
...
...
@@ -141,16 +151,32 @@ function select_product_from_bc(barcode) {
if
(
scannedProduct
.
rule
!==
'price_to_weight'
)
{
if
(
foundProduct
.
data
.
product_uom
[
0
]
!=
21
)
{
setLineEdition
(
foundProduct
.
data
);
}
if
(
foundProduct
.
place
===
'to_process'
)
{
let
row
=
table_to_process
.
row
(
$
(
'#'
+
foundProduct
.
data
.
product_id
[
0
]));
if
(
foundProduct
.
place
==
'processed'
)
{
//https://redmine.coopdev.fr/issues/4820 specs
foundProduct
.
data
.
product_qty
=
qtyOfProcessedProduct
;
alert
(
"Attention, "
+
qtyOfProcessedProduct
+
" unités de mesure de ce produit ont déjà été comptées."
);
$
(
'#'
+
product_id
+
' > td > #processed_line_edit'
).
click
();
}
else
{
//place == to_process
$
(
'#'
+
product_id
+
' > td > .toProcess_line_edit'
).
click
();
}
}
else
{
if
(
foundProduct
.
place
===
'to_process'
)
{
let
row
=
table_to_process
.
row
(
$
(
'#'
+
foundProduct
.
data
.
product_id
[
0
]));
remove_from_toProcess
(
row
,
foundProduct
.
data
);
remove_from_toProcess
(
row
,
foundProduct
.
data
);
}
// Don't remove product from processed list
}
// Don't remove product from processed list
}
}
else
{
//product found in odoo but it's not in this receipt
alert
(
"Article trouvé non concerné par cette réception.
\
n"
+
"Le code barre "
+
barcode
+
" n'est associé à aucun article de cette réception."
+
" Mettez ce produit de côté et prévenez un salarié.
\
n"
+
"ATTENTION : A la fin de la réception, ne validez pas tant que ce colis n'a pas été ajouté par le salarié.e"
);
return
-
1
;
}
}
}
catch
(
e
)
{
...
...
@@ -374,6 +400,11 @@ function fetch_data(po_ids = null) {
// Load barcodes at page loading, then barcodes are stored locally
var
get_barcodes
=
async
function
()
{
if
(
barcodes
==
null
)
barcodes
=
await
init_barcodes
();
//A partial test of https://redmine.coopdev.fr/issues/4950 without scanner : choose barcode and uncomment following line.
//If you paste this line in the console, the focus().select() will not work, but it will work in real conditions
//select_product_from_bc("0493408000008");
//select_product_from_bc("0490010008521");
//select_product_from_bc("0490010008651");
};
// Get labels to print for current orders from server
...
...
@@ -817,6 +848,7 @@ function initLists() {
$
(
'table.dataTable'
).
DataTable
()
.
search
(
''
)
.
draw
();
$
(
"#edition_input"
).
focus
().
select
();
}
}
catch
(
e
)
{
err
=
{
msg
:
e
.
name
+
' : '
+
e
.
message
,
ctx
:
'initLists : listener edit line from list to process'
};
...
...
@@ -874,6 +906,7 @@ function initLists() {
$
(
'table.dataTable'
).
DataTable
()
.
search
(
''
)
.
draw
();
$
(
"#edition_input"
).
focus
().
select
();
}
}
catch
(
e
)
{
err
=
{
...
...
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