OCA / stock-logistics-barcode

https://odoo-community.org/psc-teams/logistics-18
GNU Affero General Public License v3.0
158 stars 324 forks source link

[RFC] stock_barcodes_gs1: add AI 310 barcode value #532

Closed dalonsod closed 3 months ago

dalonsod commented 10 months ago

Hello,

according current implementation of stock_barcodes_gs1 addon, only (01, 02, 10, 37) AIs are implemented. For product quantity, 37 is used, but it should be altered via _process_product_qty_gs1 hook method within main processing method (https://github.com/OCA/stock-logistics-barcode/blob/14.0/stock_barcodes_gs1/wizard/stock_barcodes_read.py#L91).

For those who e.g. work with net weights as quantity unit, 310x (like 3102, 3.50 kg => 00350) is usually used, that we've tested that is successfully filled in base_gs1_barcode decode method as 310 key.

In my case I'd simply solve if this piece of code:

https://github.com/OCA/stock-logistics-barcode/blob/63a0576ccce0fbffa04ca8765e4622c0c92eba77/stock_barcodes_gs1/wizard/stock_barcodes_read.py#L67C9-L67C21

both 37 and 310 should be accepted. But, if this proposal shouldn't be a good approach (this could be inconsistent with current implementation and could be rejected), I cannot use hook method _process_product_qty_gs1 because barcode_decoded dict with all values (including my desired 310 alternative quantity) is not available for hook method.

Why should be the proper approach for this?

I could make a PR with the finest solution.

@sergio-teruel @etobella what do you think?

cc @ChristianSantamaria

etobella commented 10 months ago

Well, IMO, I see another option :thinking:

Add the hook of product_qty here: https://github.com/OCA/stock-logistics-barcode/blob/63a0576ccce0fbffa04ca8765e4622c0c92eba77/stock_barcodes_gs1/wizard/stock_barcodes_read.py#L89

We should do that in order to pass the product and package to the hook, that would be cleaner and we could decide to use 310 when the unit of the product is of a weight kind. WDYT?

sergio-teruel commented 10 months ago

Hi. Why not add the hook here:

https://github.com/OCA/stock-logistics-barcode/blob/14.0/stock_barcodes_gs1/wizard/stock_barcodes_read.py#L67

Create a method to get product_qty from (37) by default if exists in barcode else get from 310 or 330 (net and gross).. if three keys exist in the same scan read ... mnhhuuuu I don't know jaja

github-actions[bot] commented 4 months ago

There hasn't been any activity on this issue in the past 6 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 issue to never become stale, please ask a PSC member to apply the "no stale" label.