← Back to Pull requests

[18.0][ADD] barcode_stock_cycle_count #21

Open
unknown opened this pull request with 505 lines diff across 6 files
View on GitHub
unknown unknown commented on Nov 06, 2026 04:21 UTC
Author

Summary

barcode_stock_cycle_count exposes OCA stock_cycle_count cycle counts in the Odoo Barcode app, so an operator can execute a planned or open count from a scanner instead of the Inventory adjustment form.

It does not reimplement cycle-count or inventory-adjustment logic. It reuses the count's linked stock.inventory adjustment and the existing OCA actions that start, apply and close it, and adds barcode screens and guarded RPC methods around them.

Why it is needed

stock_cycle_count can schedule counts and create their inventory adjustments, but executing a count still requires the back-office Inventory UI. Warehouse operators need to walk to the location, scan products and lots/serials, see theoretical, counted and difference quantities, and apply or close the count on the spot.

What it does

  • Adds a Cycle Count tile to the Barcode app.

  • Lists planned and open counts for the current company, scoped by default to the current user or unassigned. Search/scan, filters for state, assignment and deadline, grouping by state and deadline, summary cards and a saved default filter are included.

  • Opens a count and gates a new or draft adjustment behind a scan of the planned location (or an explicit continue without scanning). An adjustment already in progress resumes directly on the count screen.

  • Creates the linked adjustment when a planned count has none, starts it, and validates the company, location and adjustment linkage. Missing, multiple or inconsistent adjustments, and another adjustment already in progress for the location, are reported instead of worked around.

  • Shows the linked adjustment's stock quants with product, lot/serial, theoretical quantity, counted quantity, difference and UoM. Scanning a product increments its line; tracked products require an existing lot/serial.

  • Adds a matching existing stock quant to the adjustment when a scanned product is in stock but not yet part of it. This only happens when the adjustment is open, has a single location, excludes sublocations and has no product filter. Scanning never creates a quant.

  • Saves lines one by one with an optimistic write_date check, so a concurrent change is detected instead of overwritten.

  • Applies non-zero differences through Odoo's action_apply_inventory, or closes a zero-difference count only after an explicit confirmation.

  • Adds the Barcode Cycle Count User group (implies Inventory manager) with access to stock.cycle.count and stock.inventory.
  • The PR also fixes barcode_scanner feedback notifications so an error level is sent to Odoo as danger instead of an invalid error notification type, with a HOOT regression test.

    How to use

    1. Install barcode_stock_cycle_count; it auto-installs when barcode_scanner and stock_cycle_count are installed.
    2. In Inventory, configure a Cycle Count Rule and let it generate a count, or create a planned count manually for a location that holds stock quants.
    3. Open the Barcode app and tap Cycle Count.
    4. Select the count, confirm/scan the expected location, then scan products and lots/serials (or enter quantities manually).
    5. Save the lines, then apply the differences. If every line matches, confirm the zero-difference close.

    Cycle counts operate on existing stock quants. Scanning a product does not create a quant. If no quant matches, or more than one matches the product and its lot/serial identity, regularize the stock through the normal Inventory flow and retry.

    How to test

    Manual:

    1. Install the module and create a planned cycle count with at least one stock quant in its location.
    2. Run through Cycle Count → select count → location → count → done, and check the linked adjustment and the cycle count state after applying.
    3. Check the guards: a wrong location scan, a count assigned to another user (hidden by default), a missing or ambiguous lot/serial, a zero-difference close without confirmation, and a line changed in another session before saving.

    Reference: @BinhexTeam T26644

    Diff: 505 lines (+378 / -127) across 6 files Reviewer: edescalona Review duration: 36005m
    All Vouch review confidence checks passed
    Residual risk 0.27 = Change Risk (0.48) × (1 − Review Confidence (0.43)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 505 lines diff across 6 files
    0.48
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    42%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.373
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #21"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 43.0% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 47.6% (MEDIUM) · Higher = larger blast radius
    47.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 43.0% · Lower = rushed or shallow review
    43.0%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 27.1% · Safe to merge
    27.1%