Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] barcodes, point_of_sale: Scanning Barcodes (Multiple Rules Apply) #499

Conversation

CarmenMiranda
Copy link

@CarmenMiranda CarmenMiranda commented May 4, 2022

Ticket#18452

[FIX] barcodes: Parsing Barcodes (Multiple Rules Apply)

Now when the Barcode match with multiple barcode patterns in the rules of the Barcode Nomenclatures all the possible matching will be returned instead of only returning the first option.

This will solve the issue that exists when more than one rule has the same barcode pattern [1] and allow doing those searches and not only searching for one option when the result can be in the second option.

For example, before this change having the "Customer Barcodes" and "Product Barcodes" with the same pattern .* as rules in the Barcode Nomenclatures if we scan in the POS the barcode "0020200002" the first that applies will be the customer for the sequence in the POS if we search for a product with the barcode "0020200002" the first rule will be "Customer" for the sequence and if there is no customer with that barcode it will return an error saying "The Point of Sale could not find any product, client, employee or action associated with the scanned barcode." which is not true because there is a product with that barcode.

Now it will return both rules instead of only the first one, also we add in the results the rule that is matching in order to keep the return almost the same as in the module barcodes_gs1_nomenclature in the method parse_gs1_rule_pattern (that is inside of their parser) returns the rule and the stock_barcode module in Odoo Enterprise use it.

[1] Issue 90353: Unknown Barcode in POS when Product exists

[FIX] point_of_sale: Barcode Error

As we can now have multiple rules (Barcode Nomenclatures) that apply in the parse of the barcode we have multiple parsed results that we can search in the scanning process we had to avoid showing the error of the function _barcodeErrorAction when we have more parsed results to search into so now we only want to show it when is the last result and none of the callbacks returned a successful response.

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@hugho-ad
Copy link
Collaborator

hugho-ad commented May 4, 2022

LGTM 👍

@hugho-ad
Copy link
Collaborator

hugho-ad commented May 4, 2022

Do the job, but this is a candidate to make a litle refactor on how error should be show up

@CarmenMiranda CarmenMiranda force-pushed the 15.0-Multiple-Barcode-Rules-Applied-POS-CarmenMiranda branch 2 times, most recently from a6f7153 to 53aa131 Compare May 4, 2022 20:14
@CarmenMiranda CarmenMiranda force-pushed the 15.0-Multiple-Barcode-Rules-Applied-POS-CarmenMiranda branch from 53aa131 to e95230b Compare November 10, 2022 16:23
Now when the Barcode match with multiple barcode patterns in the rules
of the Barcode Nomenclatures all the possible matching will be returned
instead of only returning the first option.

This will solve the issue that exists when more than one rule has the
same barcode pattern [1] and allow doing those searches and not only
searching for one option when the result can be in the second option.

For example, before this change having the "Customer Barcodes" and
"Product Barcodes" with the same pattern `.*` as rules in the Barcode
Nomenclatures if we scan in the POS the barcode "0020200002" the first
that applies will be the customer for the sequence
in the POS if we search for a product with the
barcode "0020200002" the first rule will be "Customer" for the sequence
and if there is no customer with that barcode it will return an error
saying "The Point of Sale could not find any product, client, employee
or action associated with the scanned barcode." which is not true
because there is a product with that barcode.

Now it will return both rules instead of only the first one, also we add
in the results the rule that is matching in order to keep the return
almost the same as in the module `barcodes_gs1_nomenclature` in the
method `parse_gs1_rule_pattern` (that is inside of their parser) returns
the rule and the `stock_barcode` module in Odoo Enterprise use it.

[1] [Issue 90353: Unknown Barcode in POS when Product exists](odoo#90353)
As we can now have multiple rules (Barcode Nomenclatures) that apply in
the parse of the barcode we have multiple parsed results that we can
search in the scanning process we had to avoid showing the error of the
function `_barcodeErrorAction` when we have more parsed results to
search into so now we only want to show it when is the last result
and none of the callbacks returned a successful response.
@CarmenMiranda CarmenMiranda force-pushed the 15.0-Multiple-Barcode-Rules-Applied-POS-CarmenMiranda branch from e95230b to e221446 Compare November 16, 2022 22:18
@hugho-ad hugho-ad closed this Dec 8, 2023
@hugho-ad
Copy link
Collaborator

hugho-ad commented Dec 8, 2023

@CarmenMiranda

Superseded by #574

@luisg123v
Copy link

Superseded*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants