[18.0][MIG] pos_product_multi_barcode#1403
Closed
thibaultrey wants to merge 26 commits into
Closed
Conversation
…roducts by multiple barcodes in search bar of POS.
Currently translated at 100.0% (5 of 5 strings) Translation: pos-14.0/pos-14.0-pos_product_multi_barcode Translate-URL: https://translation.odoo-community.org/projects/pos-14-0/pos-14-0-pos_product_multi_barcode/it/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: pos-16.0/pos-16.0-pos_product_multi_barcode Translate-URL: https://translation.odoo-community.org/projects/pos-16-0/pos-16-0-pos_product_multi_barcode/
Currently translated at 100.0% (3 of 3 strings) Translation: pos-16.0/pos-16.0-pos_product_multi_barcode Translate-URL: https://translation.odoo-community.org/projects/pos-16-0/pos-16-0-pos_product_multi_barcode/it/
Currently translated at 100.0% (3 of 3 strings) Translation: pos-16.0/pos-16.0-pos_product_multi_barcode Translate-URL: https://translation.odoo-community.org/projects/pos-16-0/pos-16-0-pos_product_multi_barcode/es/
If a `barcode` is already in `product_by_barcode`, do not override it, as Odoo does with `product_by_id`. This can lead to incoherent data if something changes after product is first loaded and then reloads (if limited loading is enabled), or it is modified in `product_by_id` and not in `product_by_barcode`.
Comment on lines
+7
to
+10
| /* Add a condition to search by barcodes_json */ | ||
| if (searchProductWord) { | ||
| domain.push(["barcode_ids.name", "in", [searchProductWord]]); | ||
| } |
There was a problem hiding this comment.
Hi, thank you for volunteering to upgrade this module. When I tried using it this override however caused some incorrect behavior, as the extra condition it appends to the domain makes it so ONLY products with a barcode matching the search term are shown.
I fixed this by modifying the domain in the following way:
// Turn every ("barcode", "ilike", term) leaf into
// ["|", ("barcode", "ilike", term), ("barcode_ids.name", "ilike", term)]
for (let i = 0; i < domain.length; i++) {
const leaf = domain[i];
if (leaf instanceof Array && leaf[0] === "barcode" && leaf[1] === "ilike") {
domain.splice(i, 0, ["barcode_ids.name", "ilike", leaf[2]]);
domain.splice(i, 0, "|");
i += 2;
}
}|
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Migration of module pos_product_multi_barcode to version 18.0