Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][FIX] stock_picking_return_restricted_qty: remove _onchange_quantity method #1799

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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."))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ced-adhoc You remove here a fucntionality. Maybe in order to get user warned before validating the return should be to add an alert on the wizard form (if it is possible) or by other mean.


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
Loading