[FIX] stock_ux: skip manual lines check on manual action_assign#950
Open
fw-bot-adhoc wants to merge 1 commit into
Open
[FIX] stock_ux: skip manual lines check on manual action_assign#950fw-bot-adhoc wants to merge 1 commit into
fw-bot-adhoc wants to merge 1 commit into
Conversation
The _check_manual_lines guard only bypassed the check when reservation came from the automatic _trigger_assign. Pressing 'Check availability' (action_assign) on a picking creates reservation move lines without the trigger_assign context, so a negative available quantity (e.g. a leftover negative quant) wrongly raised 'You can't transfer more quantity than the quantity on stock!'. Set trigger_assign in _action_assign so the manual button bypasses _check_quantity_available too. X-original-commit: 5510a86
Collaborator
Contributor
Author
|
@jcadhoc @mav-adhoc this PR targets 19.0 and is the last of the forward-port chain. To merge the full chain, use
More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
Pressing Check availability (
action_assign) on a picking could wrongly raise:_check_manual_lines(instock.move.line.create) runs_check_quantity_available, which is meant to block users from manually loading more quantity than available. That check is bypassed when the reservation comes from the automatic_trigger_assign(it sets thetrigger_assigncontext key).But the manual
action_assignbutton goes straight tostock.move._action_assign()without that context, so when the source location has a negative available quantity (e.g. a leftover negative quant), assigning creates reservation move lines whose_check_quantity_available()is negative and the validation fires — even thoughaction_assignis not loading manual lines, just reserving.Fix
Override
stock.move._action_assignto settrigger_assign=Truein context, mirroring_trigger_assign. Reservation (manual or automatic) now consistently bypasses_check_quantity_available, while manual edits on move lines remain blocked as before.Forward-Port-Of: #947