Skip to content

Conversation

@sergio-teruel
Copy link
Contributor

@sergio-teruel sergio-teruel commented Aug 1, 2024

oca-travis and others added 19 commits August 1, 2024 13:20
try the AI 240 'Additional product identification assigned
by the manufacturer'
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: stock-logistics-barcode-11.0/stock-logistics-barcode-11.0-stock_barcodes_gs1
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-barcode-11-0/stock-logistics-barcode-11-0-stock_barcodes_gs1/
* Do not replace the quantity if a package is readed, we should multiply it
* Use the product barcode as a packaging barcode if no packaging barcode has been read and no product has been found
* Auto create lot controlled from barcode options.
* Check required options before processing.
* Reduce complexity of `process_barcode` and enhance extensibility
  of package barcode processing.
* More extensibility on product_qty handling.
* Align new lot wizard with barcodes read one by adding support to
  AI 240
@sergio-teruel sergio-teruel marked this pull request as draft August 1, 2024 11:21
@sergio-teruel
Copy link
Contributor Author

Done

@pedrobaeza
Copy link
Member

@sergio-teruel sergio-teruel force-pushed the 16.0-mig-stock_barcodes_gs1 branch from 8c82a66 to 621be5b Compare August 2, 2024 10:08
result = super().parse_gs1_rule_pattern(match, rule)
result["use_weight_as_unit"] = True if rule.use_weight_as_unit else False
if result:
result["use_weight_as_unit"] = True if rule.use_weight_as_unit else False
Copy link
Member

Choose a reason for hiding this comment

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

result["use_weight_as_unit"] = bool(rule.use_weight_as_unit)

"barcodes_gs1_nomenclature.default_gs1_nomenclature"
)
# Odoo creash with default separator (Alt029|#|\x1D) so remove it from settings
gs1_nomenclature.gs1_separator_fnc1 = False

Choose a reason for hiding this comment

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

I think you can't initialize the gs1_separator_fnc1 field as False because it's a Char field. I think initializing it with an empty string ("") should work.

@alexis-via
Copy link
Contributor

I just found a bug in stock_barcodes / stock_barcodes_gs1 which is fully reproductible: when you receive a product tracked by serial number with a GS1 barcode such as (02)product_code(21)serialnumber in multiple quantities:

  1. in the scan interface: when you scan the GS1 barcode of the first product with serial SN001=> works well, no error
  2. when you scan the GS1 barcode of the second product (same product_id as the first scan with a different serial SN002), you get a red banner "SN002 (S/N Already in picking)"

When you analyse the code: the error is located here: https://github.com/OCA/stock-logistics-barcode/blob/16.0/stock_barcodes/wizard/stock_barcodes_read_picking.py#L533
When you see the condition that leads to the error, you see that it uses "sml.lot_id == self.lot_id or sml.lot_name == self.lot_id.name". When you scan the second barcode, self.lot_id still points to the first serial.
When you look at the code of stock_barcode_gs1, on that line of code https://github.com/Tecnativa/stock-logistics-barcode/blob/16.0-mig-stock_barcodes_gs1/stock_barcodes_gs1/wizard/stock_barcodes_read.py#L59 you see that the code sets "self.lot_name", but not "self.lot_id".

I feel that the code of stock_barcodes considers that, when entering the method _process_stock_move_line(), self.lot_id should be set to the scanned badcode, whereas the code of stock_barcode_gs1 considers that it just has to set self.lot_name. Or there is a problem linked to the fact that self.lot_id is set later in the execution order. I'm not an expert of the code of stock_barcodes, so my analysis may not be the right one.

@alexis-via
Copy link
Contributor

To fix the bug on products tracked by serial when receiving multiple quantities of the same product, I changed the code in stock_barcodes AND stock_barcodes_gs1:

The idea behind the change in stock_barcodes_gs1 is to reset self.lot_id when reading the GS1 barcode and setting self.lot_name, so that self.lot_id doesn't point to the previously scanned barcode any more.
In stock_barcodes, I made 2 changes:

  • use self.lot_name instead of self.lot_id.name => needed to fix the bug
  • use float_compare() => not needed to fix the bug, but it may avoid future bugs !

As I am not familiar with the codebase of stock_barcodes, my changes may not be the rights ones and it may break other scenarios. That's why I just put out those diffs and I didn't propose a PR.
But I use those diffs in production now, because I was obliged to fix the bug ASAP.

@edescalona
Copy link

Hi @sergio-teruel , could you please correct @kluna1998 suggestion?

And check why the runboat is failing?

Otherwise, it seems fine to me. Thanks for your contribution.

@edescalona edescalona mentioned this pull request May 21, 2025
2 tasks
@sergio-teruel
Copy link
Contributor Author

Hi...

I will review this week sorry!!!

lbelorgey added a commit to lbelorgey/stock-logistics-barcode that referenced this pull request Sep 1, 2025
lbelorgey added a commit to lbelorgey/stock-logistics-barcode that referenced this pull request Sep 1, 2025
lbelorgey added a commit to lbelorgey/stock-logistics-barcode that referenced this pull request Sep 6, 2025
lbelorgey added a commit to lbelorgey/stock-logistics-barcode that referenced this pull request Sep 8, 2025
@github-actions
Copy link

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 Sep 21, 2025
@pedrobaeza pedrobaeza removed the stale PR/Issue without recent activity, it'll be soon closed automatically. label Sep 22, 2025
lbelorgey added a commit to lbelorgey/stock-logistics-barcode that referenced this pull request Oct 1, 2025
@ivs-cetmix
Copy link
Member

Hi @sergio-teruel thank you for your contribution! any chances to fix the tests?

@sergio-teruel
Copy link
Contributor Author

Hi @ivs-cetmix Not Yet!!! Sorry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.