Skip to content

[18.0][MIG] pos_product_multi_barcode#1403

Closed
thibaultrey wants to merge 26 commits into
OCA:18.0from
akretion:18.0-mig-pos_product_multi_barcode
Closed

[18.0][MIG] pos_product_multi_barcode#1403
thibaultrey wants to merge 26 commits into
OCA:18.0from
akretion:18.0-mig-pos_product_multi_barcode

Conversation

@thibaultrey

Copy link
Copy Markdown

Migration of module pos_product_multi_barcode to version 18.0

Pierrick Brun and others added 26 commits April 3, 2025 18:27
…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]]);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
    }
}

@github-actions

github-actions Bot commented Feb 1, 2026

Copy link
Copy Markdown

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.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions Bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Feb 1, 2026
@github-actions github-actions Bot closed this Mar 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale PR/Issue without recent activity, it'll be soon closed automatically.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants