Skip to content

Commit

Permalink
[IMP]stock_ux: _check_manual_lines method
Browse files Browse the repository at this point in the history
  • Loading branch information
mav-adhoc committed Oct 30, 2024
1 parent 235dc21 commit 95a4fee
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion stock_ux/models/stock_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,17 @@ def _check_manual_lines(self):
if any(self.filtered(
lambda x:
not x.location_id.should_bypass_reservation() and
x.picking_id.picking_type_id.block_manual_lines)):
x.picking_id.picking_type_id.block_manual_lines and
x._check_reserved_quantity() < x.quantity)):
raise ValidationError(_(
"You can't transfer more quantity than reserved one!"))

def _check_reserved_quantity(self):
sum = 0
for rec in self.picking_id.move_line_ids:
sum += rec.quantity
return sum

@api.constrains('quantity')
def _check_quantity(self):
"""If we work on move lines we want to ensure quantities are ok"""
Expand Down

0 comments on commit 95a4fee

Please sign in to comment.