[15.0] [IMP] barcodes, point_of_sale: Scanning Barcodes (Multiple Rules Apply) #574
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
OPW #2841018
[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] odoo#90353
[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