From 40b0bdfd3a2e2881343918f709463084f6066a57 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Carreras Date: Thu, 11 Jun 2026 17:30:29 +0000 Subject: [PATCH] [FIX] stock_ux: skip manual lines check on manual action_assign 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: 5510a864c7fa81e197b0c52486c3933f87d7908c --- stock_ux/models/stock_move.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/stock_ux/models/stock_move.py b/stock_ux/models/stock_move.py index 4028a499f..ddb54e336 100644 --- a/stock_ux/models/stock_move.py +++ b/stock_ux/models/stock_move.py @@ -151,6 +151,15 @@ def _trigger_assign(self): return super().with_context(trigger_assign=True)._trigger_assign() return super()._trigger_assign() + def _action_assign(self, force_qty=False): + """Reservar / Comprobar disponibilidad crea líneas de reserva, no líneas + cargadas a mano, por lo que no debe dispararse el chequeo de + _check_manual_lines. El _trigger_assign automático ya lo evitaba, pero el + action_assign manual del picking no pasaba por ahí; marcamos el contexto + para saltear _check_quantity_available al crear las stock.move.line. + """ + return super(StockMove, self.with_context(trigger_assign=True))._action_assign(force_qty=force_qty) + @api.ondelete(at_uninstall=False) def _unlink_if_not_from_order(self): """