Skip to content

[FIX] stock_ux: skip manual lines check on manual action_assign#950

Open
fw-bot-adhoc wants to merge 1 commit into
ingadhoc:19.0from
adhoc-dev:19.0-18.0-h-119820-jc-6473-fw
Open

[FIX] stock_ux: skip manual lines check on manual action_assign#950
fw-bot-adhoc wants to merge 1 commit into
ingadhoc:19.0from
adhoc-dev:19.0-18.0-h-119820-jc-6473-fw

Conversation

@fw-bot-adhoc

Copy link
Copy Markdown
Contributor

Problem

Pressing Check availability (action_assign) on a picking could wrongly raise:

You can't transfer more quantity than the quantity on stock!

_check_manual_lines (in stock.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 the trigger_assign context key).

But the manual action_assign button goes straight to stock.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 though action_assign is not loading manual lines, just reserving.

Fix

Override stock.move._action_assign to set trigger_assign=True in 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

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
@roboadhoc

Copy link
Copy Markdown
Collaborator

Pull request status dashboard

@fw-bot-adhoc

Copy link
Copy Markdown
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

@roboadhoc r+

More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port

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.

3 participants