Skip to content

[19.0][IMP] stock_exception: fixes, demo data and docs on top of #2585 - #2

Merged
lef-adhoc merged 6 commits into
adhoc-dev:19.0-t-75458-leffrom
bosd:19.0-mig-stock_exception-imp
Nov 25, 2026
Merged

lef-adhoc merged 6 commits into
adhoc-dev:19.0-t-75458-leffrom
bosd:19.0-mig-stock_exception-imp

Conversation

@bosd

@bosd bosd commented Nov 24, 2026

Copy link
Copy Markdown

Improvements on top of OCA#2585, to merge into its branch. Each commit stands on its own, so pick what you like.

  • [DO NOT MERGE] test-requirements.txt: installs base_exception from [19.0][FWP] base_exception: forward port missing commits from 18.0 OCA/server-tools#3879. With it the CI goes green, and runboat gets the new base_exception; with the released one the popup never shows. Drop this commit once #3879 is merged.
  • [FIX] detect in the current transaction: these are the two fixes from my review, with tests.
    • The state constraint runs the detection on a picking that is not committed yet, for example one created by a sale order confirmation. As soon as a rule applies, that ends in MissingError.
    • The cron raised on the first picking with an exception.
  • [FIX] check the moves when the picking has an exception: super().detect_exceptions() now raises as soon as a picking rule applies, so the move rules were never checked. Only the picking's exceptions were shown, and a blocking rule on a move could be ignored together with them. On 17.0 both were collected.
  • [IMP] new OCA icon.
  • [FIX] .po cleanup: odoo-lint PO101 found translations of terms that are no longer in the .pot.
  • [IMP] demo data and docs.
    • The demo adds a customer tagged Credit Hold, with a warning rule on the picking, a blocking rule on its moves (more than 10 units), and a draft delivery. Both rules only apply to that customer, so they don't affect other tests in the repo. Runboat then has something to show: the shipped rules are all archived.
    • DESCRIPTION is rewritten. There are new CONFIGURE and USAGE fragments: when the rules are checked, how to set one up, and where and with which text the exceptions are shown (the rule's name and description, in the popup, on the form banner and in the list).

All 7 tests pass locally against #3879, and I checked the demo flow by hand: warning, ignore, then blocking. pre-commit and odoo-lint are clean.

Not changed, but worth a look: after Ignore Exceptions in the popup, the wizard always calls action_confirm(). When the popup came from Validate, the transfer is not validated, and the user has to click Validate again. The USAGE text describes the current behaviour.

bosd added 6 commits November 24, 2026 21:24
The state constraint runs the detection for pickings that may not be
committed yet, e.g. created by a sale order confirmation. The detection
then writes the exceptions through a second cursor that cannot see them,
and fails with MissingError. The cron raised BaseExceptionError on the
first picking with an exception. Both now store the exceptions without
rolling back.
Found by odoo-lint (PO101): these msgids are no longer in the .pot, so
Odoo ignores them.
The detection on the pickings now raises as soon as one of their rules
applies, so the rules on the stock moves were never checked in that case:
only the exceptions of the picking were shown, and a blocking rule on a
move could be ignored together with them. Check the moves before raising.
Add demo rules that only apply to a demo customer on credit hold, one that
warns on the picking and one that blocks on its moves, and a draft delivery
to try them.

Describe when the rules are checked, how to configure them, and where and
with which text the exceptions are shown: the name and description of the
rule, in the popup, the banner on the transfer and the list of transfers.
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.

2 participants