Skip to content

[18.0][MIG] stock_location_flowable: Migration to 18.0#720

Open
deeniiz wants to merge 31 commits into18.0from
18.0-mig-stock_location_flowable
Open

[18.0][MIG] stock_location_flowable: Migration to 18.0#720
deeniiz wants to merge 31 commits into18.0from
18.0-mig-stock_location_flowable

Conversation

@deeniiz
Copy link
Copy Markdown
Collaborator

@deeniiz deeniiz commented Sep 23, 2025

No description provided.

Copilot AI review requested due to automatic review settings September 23, 2025 15:34
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR migrates the stock_location_flowable module from an earlier version to 18.0. The module provides functionality for managing flowable storage locations that can hold liquid and solid bulk products with specific constraints around product mixing and manufacturing operations.

Key changes:

  • Migration to Odoo 18.0 framework
  • Updated copyright headers to 2025
  • Updated Spanish translations

Reviewed Changes

Copilot reviewed 28 out of 29 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
__manifest__.py Updated version to 18.0.1.0.0 and dependencies
models/*.py Core business logic for flowable locations, picking operations, and manufacturing integration
views/*.xml XML view definitions for enhanced UI forms and lists
tests/*.py Comprehensive test coverage for module functionality
i18n/es.po Spanish translation updates
readme/ and static/ Documentation and static assets

Comment on lines +125 to +126
_("Capacity must be greater than capacity occupied %s")
% rec.flowable_capacity_occupied
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

Missing space between 'occupied' and '%s' placeholder in the error message. Should be 'capacity occupied %s' for better readability.

Copilot uses AI. Check for mistakes.
if product not in location_dest.flowable_allowed_product_ids:
raise UserError(
_(
"Product %(product)s not allowed in"
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

Missing space between 'in' and 'flowable' in the error message string. Should be 'not allowed in flowable location' for proper grammar.

Suggested change
"Product %(product)s not allowed in"
"Product %(product)s not allowed in "

Copilot uses AI. Check for mistakes.
Comment thread stock_location_flowable/i18n/es.po Outdated
#. module: stock_location_flowable
#: code:addons/stock_location_flowable/models/stock_picking_type.py:0
#, python-format
msgid "Only one picking type can be flowable in a warehouse %s.."
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

The English msgid has a double period '..' at the end which should be a single period '.'.

Suggested change
msgid "Only one picking type can be flowable in a warehouse %s.."
msgid "Only one picking type can be flowable in a warehouse %s."

Copilot uses AI. Check for mistakes.
@deeniiz deeniiz force-pushed the 18.0-mig-stock_location_flowable branch from 2367397 to 2c84907 Compare January 13, 2026 15:49
@deeniiz deeniiz force-pushed the 18.0-mig-stock_location_flowable branch from 2c84907 to 78a418c Compare March 12, 2026 11:29
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 12, 2026

Codecov Report

❌ Patch coverage is 98.19885% with 25 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (18.0@4b294fd). Learn more about missing BASE report.

Files with missing lines Patch % Lines
stock_location_flowable/models/mrp_production.py 88.70% 3 Missing and 4 partials ⚠️
stock_location_flowable/models/stock_picking.py 95.40% 2 Missing and 2 partials ⚠️
stock_location_flowable/models/stock_move.py 86.36% 1 Missing and 2 partials ⚠️
stock_location_flowable/tests/test_common.py 95.38% 0 Missing and 3 partials ⚠️
...ock_location_flowable/tests/test_mrp_production.py 98.95% 1 Missing and 2 partials ⚠️
...cation_flowable/tests/test_stock_return_picking.py 94.54% 1 Missing and 2 partials ⚠️
stock_location_flowable/models/stock_location.py 98.23% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             18.0     #720   +/-   ##
=======================================
  Coverage        ?   98.19%           
=======================================
  Files           ?       20           
  Lines           ?     1388           
  Branches        ?      117           
=======================================
  Hits            ?     1363           
  Misses          ?        8           
  Partials        ?       17           

☔ 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.

FrankC013 and others added 21 commits March 16, 2026 09:29
…rch per product

Move mrp_operation_type search and validation out of the per-product
loop and into a single check per picking, running only when there are
flowable destination lines. Skip non-flowable pickings early with
continue.

Update error messages to reference warehouse instead of location:
- "Not found flowable manufacturing picking type in warehouse %s"
- "More than one flowable manufacturing picking type in warehouse %s"
- "Not found sequence in flowable manufacturing picking type %s"

Adapt tests to match the new validation order and messages:
- Enable flowable_operation in tests that expect product-level errors
  (one product, not allowed, different UoM) since the mrp_operation_type
  check now runs before those validations
- Update expected error message strings in
  test_not_found_manufacturing_picking_type_incoming_picking and
  test_mrp_operation_type_without_sequence_raises_error
…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.
…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.
eantones and others added 8 commits March 16, 2026 09:29
…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.
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)
Rename all test data to use liquid gas domain examples instead of
generic or Spanish names, making tests self-documenting and consistent
with the real-world use case.

Products: Liquid O2, Liquid N2, Liquid He, etc.
Locations: O2 Tank 1..6, Warehouse Shelf
UoM categories: Liquid O2 (kg/L density conversion)
Non-gas products: Steel Bolts (for "not allowed" scenarios)
When a reception has multiple move lines targeting the same flowable
location with the same product and lot, they must be aggregated into a
single manufacturing order.
…g flowable lines

The old message ("You can only receive one product at location...") was
confusing: it mentioned "one product" even when the conflict was between
lots, not products, and gave vague instructions.

The new message lists the conflicting product/lot combinations and tells
the user to create a backorder. Also adds a comment explaining why we
keep the pre-check instead of relying on the blocking mechanism (EAFP):
the natural constraint error would reference a phantom MO from the same
rolled-back transaction.
After completing a flowable mixing order, verify that all non-producing
lots at the location have exactly 0 stock using float_is_zero with UoM
rounding. This should not be necessary under normal operation and might
be removed in the future, but catches rounding residuals or manual
inventory adjustments that could silently corrupt stock.
…kflows

Cover additional flowable scenarios that follow natural user workflows:
picking with mixed flowable/non-flowable lines, sequential receptions
with MO completion between each, pre-check rejection of multiple lots
to the same location, blocked location preventing a second reception,
different lots to different locations in one receipt, zero-qty lines
ignored, top-up with same lot at auto-lot location, return from mixed
picking, rounding residual quant detection, and defensive post-production
quant check for both create_lots modes.
@deeniiz deeniiz force-pushed the 18.0-mig-stock_location_flowable branch from 78a418c to 38d191e Compare March 16, 2026 17:23
@deeniiz deeniiz force-pushed the 18.0-mig-stock_location_flowable branch from 237ab6f to d22e471 Compare March 17, 2026 15:06
@deeniiz deeniiz requested a review from eantones March 17, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants