Skip to content

[14.0][FIX] stock_location_flowable: flowable location blocking#849

Open
eantones wants to merge 10 commits into14.0from
14.0-fix-stock_location_flowable-flowable_blocking-v2
Open

[14.0][FIX] stock_location_flowable: flowable location blocking#849
eantones wants to merge 10 commits into14.0from
14.0-fix-stock_location_flowable-flowable_blocking-v2

Conversation

@eantones
Copy link
Member

Supersedes #847

Summary

  • Fix non-MO moves bypassing blocked location check (production lookup now uses raw_material_production_id or production_id instead of state-based logic)
  • Prevent premature blocking and reservation conflicts: location blocking now only triggers on assigned state, _trigger_assign is bypassed during picking completion, and a post-reservation check ensures the mixing order can be fully reserved
  • Refactor stock move write method for readability: early return, disjoint state branches
  • Add blocking lifecycle tests and reservation conflict tests
  • Add flowable blocking technical documentation with SVG diagrams
  • Update module metadata and contributors
  • Add complete Catalan and Spanish translations

Test plan

  • All 68 existing tests pass
  • Verify flowable location blocks on reception and unblocks on MO completion
  • Verify second reception to blocked location is rejected
  • Verify reception with pending reservations raises descriptive error
  • Verify reception succeeds after unreserving all operations

…heck

The blocked-location constraint in stock_move_line.py used the move's
state to decide which production field to check (production_id vs
raw_material_production_id). Moves not linked to any MO (e.g. a second
PO reception or an internal transfer) had production=False, and the
guard `if production and ...` was skipped entirely — allowing writes
to a blocked location.

Change the production lookup to `raw_material_production_id or
production_id` (always finds the linked MO if any) and invert the
guard to check `if location.flowable_production_id and ... \!= production`
so the constraint fires on any move to a blocked location, regardless
of origin.
…tion conflicts

Before this fix, flowable locations were blocked as soon as raw materials
entered confirmed or partially_available state, causing false rejections
of incoming receipts.

Now blocking only occurs when all raw materials reach assigned state.
Additionally, _trigger_assign is bypassed during picking completion to
prevent automatic reservation of unrelated moves at the flowable location,
and a post-reservation check (action_assign override) ensures the mixing
order can be fully reserved before proceeding.
Restructure the write method for clarity: early return for
non-flowable operations, separate state checks into disjoint
branches, and skip iterations when state is not changing.
Add tests covering the full flowable location blocking lifecycle:
reception blocking, second reception rejection, full cycle
(block/unblock), per-location isolation, auto-lot assignment,
and non-flowable location passthrough.
…ntation

Add comprehensive technical documentation explaining the flowable
location blocking mechanism, including SVG diagrams covering the full
lifecycle: reception, blocking, second reception rejection, MO
completion, cancellation, internal transfers, and reservation conflicts.
Fix manifest author to match pylintrc-mandatory requirements and
update CONTRIBUTORS.rst to proper RST format with Eric Antones.
Regenerate README.rst and index.html via oca-gen-addon-readme.
Add complete Catalan (ca.po) and Spanish (es.po) translation files
covering all translatable strings in the module.
@codecov
Copy link

codecov bot commented Feb 27, 2026

Codecov Report

❌ Patch coverage is 95.92391% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.07%. Comparing base (9e96279) to head (e8089d6).

Files with missing lines Patch % Lines
stock_location_flowable/models/mrp_production.py 84.00% 2 Missing and 2 partials ⚠️
stock_location_flowable/models/stock_picking.py 66.66% 2 Missing and 2 partials ⚠️
stock_location_flowable/tests/test_common.py 91.89% 0 Missing and 3 partials ⚠️
stock_location_flowable/models/stock_move.py 84.61% 0 Missing and 2 partials ⚠️
...ock_location_flowable/tests/test_mrp_production.py 98.21% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             14.0     #849      +/-   ##
==========================================
+ Coverage   49.30%   50.07%   +0.76%     
==========================================
  Files         971      971              
  Lines       15971    16217     +246     
  Branches     3450     3477      +27     
==========================================
+ Hits         7874     8120     +246     
+ Misses       7889     7886       -3     
- Partials      208      211       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…lowable MO

Add a safety check that verifies the number of positive quants at a
flowable location before creating the manufacturing order. On initial
reception (empty tank) there must be exactly 1 quant. On mixing
(different lot arrives) there must be exactly 2 quants, one for each
lot. This catches data inconsistencies early instead of letting the
MO be created with wrong inputs.
…to TestCommon

Move shared test helpers (_create_lot, _receive_stock, _create_incoming_picking,
_find_flowable_production, _get_location_quants, _get_positive_quantity,
_seed_flowable_location, _create_inventory_adjustment) from individual test
classes into TestCommon. Rebase TestFlowableBlockingWithReservations on
TestCommon instead of SavepointCase. Replace all inline duplicated patterns
across 8 test files with helper calls.
@eantones eantones force-pushed the 14.0-fix-stock_location_flowable-flowable_blocking-v2 branch from d5612af to 08ef48d Compare February 28, 2026 00:08
Add 4 natural user-workflow tests covering previously untested code
paths in the flowable blocking lifecycle:

- MO-based reservation conflict detection (mrp_production lines 93-99)
- Capacity reduction below occupied amount (stock_location line 123)
- Flowable conversion with incompatible UoM stock (stock_location
  lines 195-198)
- Mixing reception with rounding residual quant (stock_picking line 242)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant