Skip to content

Commit

Permalink
[16.0][FIX] stock_picking_return_restricted_qty: remove _onchange_qua…
Browse files Browse the repository at this point in the history
…ntity method
  • Loading branch information
ced-adhoc committed Dec 19, 2024
1 parent 69d27dd commit 8398544
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def test_multiple_return(self):

wiz.product_return_moves.quantity = 80
with self.assertRaises(UserError):
wiz.product_return_moves._onchange_quantity()
wiz._create_returns()

def test_multiple_return_without_restriction(self):
"""On this test we are going to follow a sequence that a client
Expand All @@ -122,5 +122,5 @@ def test_multiple_return_without_restriction(self):
self.assertEqual(wiz.product_return_moves.quantity, 10)

wiz.product_return_moves.quantity = 80
wiz.product_return_moves._onchange_quantity()
wiz._create_returns()
self.assertEqual(wiz.product_return_moves.quantity, 80)
11 changes: 0 additions & 11 deletions stock_picking_return_restricted_qty/wizard/stock_picking_return.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,6 @@ def _create_returns(self):
class ReturnPickingLine(models.TransientModel):
_inherit = "stock.return.picking.line"

@api.onchange("quantity")
def _onchange_quantity(self):
restrict_return_qty = (
self.move_id.picking_id.picking_type_id.restrict_return_qty
)

qty = self.get_returned_restricted_quantity(self.move_id)

if restrict_return_qty and self.quantity > qty:
raise UserError(_("Return more quantities than delivered is not allowed."))

def get_returned_restricted_quantity(self, stock_move):
"""This function is created to know how many products
have the person who tries to create a return picking
Expand Down

0 comments on commit 8398544

Please sign in to comment.