You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[FIX] stock: avoid lot required error when scrapping tracked products without picking
When scrapping a tracked product without a lot and without a picking_type_id,
`stock.move.line._action_done` raises a UserError requiring a lot/serial number.
This happens because the method checks for the absence of both
`picking_type_id`, `is_inventory`, and `lot_id`, assuming a lot is always
mandatory outside inventory and picking flows.
However, scrap operations may occur outside these flows and should not
necessarily require a lot, especially when triggered programmatically
(e.g. via API or automation), bypassing the form view validation.
This commit updates the condition in `_action_done()` to check the context
key `is_scrap`, which is already passed in `do_scrap()` via
`move.with_context(is_scrap=True)._action_done()`.
This allows tracked products to be scrapped without a lot in valid scenarios,
without misleadingly assigning a `picking_type_id` to the move.
closesodoo#213536
X-original-commit: a14c8dc
Signed-off-by: William Henrotin (whe) <[email protected]>
0 commit comments