Skip to content

Fork Sync Branch 18.0 - #14

Merged
btl-bot merged 2 commits into
BTLzdravtech:18.0from
ingadhoc:18.0
Aug 27, 2026
Merged

btl-bot merged 2 commits into
BTLzdravtech:18.0from
ingadhoc:18.0

Conversation

@btl-bot

@btl-bot btl-bot commented Aug 27, 2026

Copy link
Copy Markdown

No description provided.

adhoc-cicd-bot and others added 2 commits August 24, 2026 20:43
…ndor receipt nor a counter-delivery

When cancelling the remaining qty, lowering product_qty does not always cancel the
pending receipt: with a refund return (ticket 124773) a live pending IN remains and
inflates the forecast of units to receive, and when the negative move does not net
against the pending one (different price/final location) a counter-delivery to the
vendor is generated (ticket 124957).

We now explicitly cancel the line's open remaining move. In 1, 2 or 3 step receptions
the pending qty to receive always lives in the first-step move (vendor->input), which
hangs off move_ids and has no downstream; core (_action_cancel) propagates to later
moves if needed, so there is no need to walk the chain. The cancel is scoped to genuine
forward vendor receipts: exchange-return replacements (a legitimate expected receipt)
and open, not-yet-validated vendor returns (origin_returned_move_id, which also hang off
move_ids and are not part of the remainder) are excluded. product_qty is not touched, so
invoicing (qty_to_invoice) stays intact.

Also replace the expensive fields_get() probe in _is_exchange_move_helper with a plain
'is_exchange_move' in self._fields check (O(1), no full field-descriptor build).

Tests (test_cancel_remaining.py, over 1/2/3 steps): partial receipt, refund return
(124773), preservation of goods in transit, and an open vendor return that must survive
cancel remaining (RED without the origin_returned_move_id guard).

closes #358

Signed-off-by: Luciano Esperlazza <les@adhoc.inc>

@sireko sireko 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.

Auto approved

@btl-bot
btl-bot merged commit 39bb5bd into BTLzdravtech:18.0 Aug 27, 2026
1 check passed
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.

4 participants