16 lines
656 B
Python
16 lines
656 B
Python
from odoo import models
|
|
|
|
class StockPicking(models.Model):
|
|
_inherit = 'stock.picking'
|
|
|
|
def _pre_action_done_hook(self):
|
|
# Odoo 17 skips auto-setting `picked = True` if _any_ line was manually picked.
|
|
# This causes unpicked lines with `quantity > 0` to be cancelled
|
|
# when the user selects "No Backorder", zeroing out their quantity.
|
|
# We enforce that any line with quantity > 0 is treated as picked.
|
|
for picking in self:
|
|
for move in picking.move_ids:
|
|
if move.quantity > 0 and not move.picked:
|
|
move.picked = True
|
|
return super()._pre_action_done_hook()
|