Skip to content

[19.0][MIG] stock_barcodes: Migration to 19.0 - #742

Open
hoattk-komit wants to merge 332 commits into
OCA:19.0from
komit-consulting:19.0-mig-stock_barcodes
Open

hoattk-komit wants to merge 332 commits into
OCA:19.0from
komit-consulting:19.0-mig-stock_barcodes

Conversation

@hoattk-komit

Copy link
Copy Markdown

@hoattk-komit hoattk-komit mentioned this pull request Feb 5, 2026
2 of 3 tasks
@hoattk-komit
hoattk-komit force-pushed the 19.0-mig-stock_barcodes branch 4 times, most recently from 767e75a to 541138f Compare February 10, 2026 11:11
@sergio-teruel

Copy link
Copy Markdown

Hi @hoattk-komit We are working in improvements in v18... Please follow it to add changes into your migration...

Thanks

@hoattk-komit

Copy link
Copy Markdown
Author

Hi @hoattk-komit We are working in improvements in v18... Please follow it to add changes into your migration...

Thanks

Thanks for your comment, I'll do it

@github-actions

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 Jun 28, 2026
@hoattk-komit
hoattk-komit force-pushed the 19.0-mig-stock_barcodes branch from 541138f to 81843ac Compare July 3, 2026 10:00
@github-actions github-actions Bot removed the stale PR/Issue without recent activity, it'll be soon closed automatically. label Jul 5, 2026
# Remove all existing move lines and create a new one with 0 quantity
# to avoid issues with reservation
stock_move.move_line_ids.unlink()
self.env["stock.move.line"].create(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should we set variable for self.env["stock.move.line"] into outside of the loop ?
example:

sml_env = self.env["stock.move.line"]
for sml in self:
.....

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This code no longer exists after rebasing on the latest 18.0

{
"name": "Product test wo lot tracking",
"type": "product",
"type": "consu",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should we also include is_storable? In version 16.0, the product type represents a storable product.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done


# Overwrite is needed to take into account new domain values
product_id = fields.Many2one(domain=[("type", "in", _allowed_product_types)])
product_id = fields.Many2one(domain=Domain("type", "in", _allowed_product_types))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should we also include is_storable in the domain? In version 16.0, the product type represents a storable product.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

domain.append(Domain("inventory_quantity_set", "=", False))
order = None
quants = self.env["stock.quant"].search(domain, order=order)
quants = self.env["stock.quant"].search(Domain.AND(domain), order=order)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should change to search_fetch?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Kept search() as in 18.0: the quants are used as full records right after (kanban and writes), so search_fetch brings no real gain here

@sergio-teruel

sergio-teruel commented Jul 17, 2026 •

Copy link
Copy Markdown

Please, @hoattk-komit , Can you review the PR in v18??

#725

Is ready to merge, after that you can base you migration from 18.0

Thanks.

weblate and others added 15 commits July 26, 2026 16:36
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: stock-logistics-barcode-15.0/stock-logistics-barcode-15.0-stock_barcodes
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-barcode-15-0/stock-logistics-barcode-15-0-stock_barcodes/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: stock-logistics-barcode-15.0/stock-logistics-barcode-15.0-stock_barcodes
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-barcode-15-0/stock-logistics-barcode-15-0-stock_barcodes/
Currently translated at 98.0% (248 of 253 strings)

Translation: stock-logistics-barcode-15.0/stock-logistics-barcode-15.0-stock_barcodes
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-barcode-15-0/stock-logistics-barcode-15-0-stock_barcodes/it/
Currently translated at 98.0% (248 of 253 strings)

Translation: stock-logistics-barcode-15.0/stock-logistics-barcode-15.0-stock_barcodes
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-barcode-15-0/stock-logistics-barcode-15-0-stock_barcodes/it/
carlosdauden and others added 19 commits October 23, 2026 16:10
Depend on stock_move_line_qty_picked and remove the duplicate field definitions, computes and SQL initialization. Reuse its view fields without displaying duplicate columns. Show picked quantities by default and explain how normal validation and partial picking behave, including Spanish translations.

Cover normal validation without entering picked quantities, manual partial quantities, scanner-to-manual and manual-to-scanner preparation, partial validation from the standard picking form and clearing scans by unpicking. The suite passes all 176 tests with the shared dependency installed.

Deploy with the stock_move_line_qty_picked installation and upgrade fix so existing prepared quantities and partial scans are preserved when the shared field is adopted.
…cords

The grouping key of the todo records is evaluated both on the moves or move lines being grouped and on the todo records themselves, to find the current todo line again after a scan. Todo records only copy some fields of their source records, so a key like object.picking_id,object.product_id raised an AttributeError when opening the reader.

Evaluate the key on the first source record of the todo line, which by definition gives the key of its group.
Port the multi-move scenarios of 18.0-FIX-stock_barcodes-sibling_moves_repartition (fffef9e). Its production changes are already part of this branch: 76dc071 excludes cancelled and done moves from the moves to do, caps a read on a line while sibling moves still have pending demand, and allocates reservations first and then the remaining unreserved demand, all in the scanned unit of measure. Only the tests were missing: serial reads going to an unreserved or reserved sibling, a real excess that still warns and can be forced, a cancelled sibling that neither absorbs reads nor counts as demand, and repeated or manual untracked reads split by demand.

The tests live in their own class based on the common fixtures instead of inheriting TestStockBarcodesPicking, which would run that whole suite a second time. The comment on the remaining quantity now states that it is a real excess over the total demand.
Quantities read are now handled by two independent options:

- Replace quantity on each reading (no_increase_qty_done) chooses whether a confirmed reading is added to the quantity already recorded or replaces it, for both the done quantity of picking move lines and the counted quantity of inventory quants. It previously only applied to pickings, while inventories used accumulate_read_quantity with the opposite meaning.
- Accumulate repeated readings (accumulate_read_quantity): with manual confirmation, reading the same product, lot or packaging again before confirming adds one unit (or packaging) to the quantity to confirm. It is applied once per scan in process_barcode, only when the barcode was matched by the product, packaging or lot option, so location scans, the lot read that completes a product reading and quantities filled from stock do not add units.

Combined, units can be counted one by one on the screen and the result replaces the counted quantity.

Confirming a counted inventory line edited from the list added its whole quantity again when readings were added; the edited quant is now always replaced.

The 18.0.1.5.0 migration keeps the inventory behavior of each database (the inventory screen always uses the Inventory group), leaves the screen accumulation disabled and maps the 15.0 move_lines value of source_pending_moves to move_ids.

The unused show_all_quantities and allow_direct_partial_delivery options are removed: nothing reads them since the candidate picking wizard was removed. The help of every option describes what the code does, and strings that called a packaging "package" (packaging quantity, "More than one packaging found", the "Put in back" typo of the put in pack button) are fixed.

The readme documents every option grouped by purpose, starting from the analysis of each operation flow with the customer, and the roadmap lists common flows not covered yet.
In 15.0 the picking internal note was shown in the candidate pickings kanban, so operators could see special instructions (e.g. coming from sale_stock_picking_note). That kanban was removed during the migration and the note was no longer displayed.

Add a computed picking_note field on the picking wizard that ignores empty HTML values, and show it at the top of the scan content in red, italic and bold. It can be hidden with the hide_note context key, as in 15.0.
Once a product is read, a button next to it on the scan screen opens a touch friendly dialog with the on hand, incoming, outgoing and forecasted quantities of the product and its stock in each internal location of the operation scope. Locations are listed in removal strategy order, reversed on receptions, and tapping one fills the destination location on receptions and the source location otherwise.

Buttons next to the source and destination location fields open the same dialog without the product quantities to just pick a location. Their context (location_stock_field, location_stock_reverse) forces the filled field and the order, so internal transfers list the source locations in removal order and the destination ones reversed. On small screens, where labels become icons, the icons replace these buttons.

_get_location_stock_field, _is_location_stock_reversed, _get_location_stock_parent_locations and _sort_location_stock let other modules change the filled field, the order and the scope.
…nation

In receptions, choosing another destination bin redirected the existing move line of the product to it, including the units already read in the previous bin. Receiving three units of a product without tracking in one bin and the last one in another left the three units in the last bin.
@hoattk-komit
hoattk-komit force-pushed the 19.0-mig-stock_barcodes branch from 07c47da to 8771c71 Compare October 23, 2026 09:20
@hoattk-komit

Copy link
Copy Markdown
Author

@hoattk-komit we also had ours here Therp#1 maybe you can cherry-pic our commits after you review and test. Alternatively we can submit ours to OCA since v18.0 has been merged #725.

Thanks @KKamaa , I reviewed your branch: your 19.0 fixes (Odoo 19 API alignment, packaging UoM dispatch, scanner tests) are included in the [MIG] commit with you as co-author. Instead of the upstream sync commit I forward-ported the 18.0 commits individually to keep their authorship.

@hoattk-komit

Copy link
Copy Markdown
Author

Hi,

Small issue in stock_barcodes/models/stock_quant.py: the override of action_apply_inventory drops the date argument of the Odoo 19 signature (def action_apply_inventory(self, date=None) in stock/models/stock_quant.py):

def action_apply_inventory(self):
    res = super().action_apply_inventory()

Any other module that overrides the method with the standard signature and calls super().action_apply_inventory(date=date) then fails with:

TypeError: StockQuant.action_apply_inventory() got an unexpected keyword argument 'date'

Suggested fix:

def action_apply_inventory(self, date=None):
    res = super().action_apply_inventory(date=date)

Thanks, fixed: the override now uses the Odoo 19 signature and passes date through.

const _origOnBarcodeScanned = BarcodeHandlerField.prototype.onBarcodeScanned;

patch(BarcodeHandlerField.prototype, {
onBarcodeScanned(event) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@hoattk-komit Odoo 19's barcode handler updates the record asynchronously. Here the original handler is called without awaiting record.update(), and dummy_on_barcode_scanned is clicked immediately afterward.
The button can therefore process an empty or previously scanned barcode before _barcode_scanned finishes its onchange.
Could we await the update before clicking, restrict this behavior to the OCA wizard's _barcode_scanned field, and add a Hoot regression test?
We fixed this in Therp commit 361bfdc0, including tests for asynchronous ordering and preserving standard Odoo barcode behavior.

import {kanbanView} from "@web/views/kanban/kanban_view";
import {registry} from "@web/core/registry";

registry.category("views").add("stock_barcodes_kanban", {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@hoattk-komit It looks like removing the custom kanban renderer also removed the subscriber for stock_barcodes_kanban_update.
stock_quant.enable_current_operations() still sends the enable_operations notification, while stock_barcodes_read_inventory_views.xml still renders the +/- buttons inside an element with d-none (line 160).
I couldn't find a replacement subscriber that removes this class, so those quantity-adjustment controls appear to remain hidden.
Could we restore this behavior in the kanban renderer or another suitable component and add a Hoot test?
The implementation in Therp's kanban_renderer.esm.js shows the previous subscription and visibility update.

vals["location_dest_id"] = self.location_dest_id.id
return vals

def action_barcode_scan(self, option_group=False, wiz=False):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@hoattk-komit Could we add self.ensure_one() at the beginning of action_barcode_scan()?
The method creates one wizard using self.id and the picking's individual fields, so its contract is clearly single-record. Making that explicit avoids confusing failures when invoked on multiple pickings.
Our Therp branch already includes this guard.

Comment thread test-requirements.txt Outdated
@@ -0,0 +1,2 @@
odoo-addon-web_widget_numeric_step @ git+https://github.com/OCA/web.git@refs/pull/3429/head#subdirectory=web_widget_numeric_step

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@hoattk-komit OCA/web#3429 (web_widget_numeric_step) was already merged into 19.0, so we can remove its temporary PR dependency here and use the standard addon dependency.
stock_move_line_qty_picked is still pending in OCA/stock-logistics-workflow#2459, which explains the remaining unreleased-dependency CI failure.
Could we clean up the merged dependency now and remove the remaining temporary PR reference once #2459 is merged?

@KKamaa

KKamaa commented Oct 23, 2026

Copy link
Copy Markdown

@hoattk-komit check codecov errors found so that the pipeline can be green

@hoattk-komit
hoattk-komit force-pushed the 19.0-mig-stock_barcodes branch from 8771c71 to 7657162 Compare October 30, 2026 09:24
@oca-cla-bot

oca-cla-bot Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

The following commit authors need to sign the Contributor License Agreement:

CLA not signed

@Quan-nhm Quan-nhm left a comment

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, it would be nice if you could review it again.
For the issue the lot I have tested and I cannot select any lot eventhough the product already have few low

Image

name="lot_id"
options="{'no_create': True, 'no_open': True}"
domain="[('product_id', '=', product_id)]"
domain="[('id', 'in', product_packaging_uom_ids)]"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why do we have Lot ID in product_packaging_uom_ids ??

"qty_picked": qty_done,
"qty_picked": self.product_id.uom_id._compute_quantity(
qty_done, line.product_uom_id, round=False
),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think the qty_done already _compute_quantity in line 692

line_qty = scan_uom._compute_quantity(
                assigned_qty, line.product_uom_id, round=False
            )

)
# Assign lot created or found to wizard scanning barcode lot_id field
product = self.product_id.sudo() if is_stock_manager else self.product_id
uom = Uom.create(self._prepare_uom_values())

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should we check if the UoM is existed or not before create a new UoM ?

hoattk-komit and others added 2 commits October 30, 2026 17:20
- Packagings are units of measure: packaging_uom_id on the scan wizards,
  packaging barcodes read from product.uom, new packaging wizard creating
  a uom.uom relative to the product unit and its product.uom barcode
- stock.quant.package -> stock.package, digits "Product Unit", no
  stock.move name, no posx/posy/posz (locations sorted by complete name)
- qty_picked comes from stock_move_line_qty_picked, as in 18.0
- action_apply_inventory(date=None) signature
- JS adapted to the Odoo 19 web client: dropped the view_button and
  view_compiler patches (core renders data-hotkey), Owl/bus API updates,
  Hoot tests
- Tests adapted to Odoo 19

Co-authored-by: Agentiko <amuntri@gmail.com>
Co-authored-by: KKamaa <kevkamaa96@gmail.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@hoattk-komit
hoattk-komit force-pushed the 19.0-mig-stock_barcodes branch from 7657162 to 3d35632 Compare October 30, 2026 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:barcodes_generator_abstract Module barcodes_generator_abstract mod:stock_barcodes Module stock_barcodes series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.