Vauxoo / odoo

Fork of Odoo (formerly OpenERP). [This project is not publically mantained just born for internal usage with some little patches] go to official repository on github.com/odoo/odoo
https://www.odoo.com
Other
9 stars 9 forks source link

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

Open hugho-ad opened 10 months ago

hugho-ad commented 10 months ago

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] https://github.com/odoo/odoo/issues/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

hugho-ad commented 10 months ago

@CarmenMiranda could you please review

cc @JVegaB

CarmenMiranda commented 10 months ago

Technically LGTM 👍🏼

It maintains both the idea of the new change that Odoo made and the idea of the previous PR (#499)