Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
odoo
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
cooperatic-foodcoops
odoo
Commits
8eeca293
Commit
8eeca293
authored
May 13, 2023
by
François C.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix perform search to be able to add weight barcode
parent
e5d21217
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
backend.js
...ette_addons/lacagette_custom_pos/static/src/js/backend.js
+6
-3
No files found.
lacagette_addons/lacagette_custom_pos/static/src/js/backend.js
View file @
8eeca293
...
...
@@ -164,20 +164,23 @@ odoo.define('lacagette_custom_pos.DB', function(require) {
// redefine odoo/addons/point_of_sale/static/src/js/screens.js to fit need
var
products
;
if
(
query
){
// let's prepare query string to find out whether it corresponds to a product barcode
let
significant_string
=
query
.
replace
(
/
[^
0-9
]
/g
,
''
)
if
(
significant_string
.
length
>
13
)
{
// The last scanned barcode is the last 13 figures
significant_string
=
significant_string
.
substring
(
significant_string
.
length
-
13
)
}
if
(
significant_string
.
length
>=
8
)
{
// it may be a barcode (it could be a string completed after getting new focus on search input)
// Remove every thing wich is not a figure
// A minimum 8 characters long figures string has been extracted : let's add corresponding product if possible
const
scan_result
=
this
.
pos
.
barcode_reader
.
barcode_parser
.
parse_barcode
(
significant_string
)
significant_string
=
scan_result
.
base_code
var
found_product
;
found_product
=
this
.
pos
.
db
.
get_product_by_barcode
(
significant_string
)
if
(
found_product
)
{
this
.
pos
.
get_order
().
add_product
(
found_product
);
this
.
pos
.
scan_product
(
scan_result
)
// scan_result contain eventually weight quantity or other encodeded data
this
.
clear_search
();
$
(
'.searchbox input'
).
blur
();
}
...
...
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