Skip to content

Commit

Permalink
[FIX] stock_manual_transfer: Prevent creation of duplicate transfers
Browse files Browse the repository at this point in the history
To prevent any potential duplication, this fix introduces a
return-early pattern. Now, transfers are not created if the manual
transfer record has already been published.

Issue reported on helpdesk ticket #25879
  • Loading branch information
allanpa88 authored and luisg123v committed May 15, 2024
1 parent 62ec4c4 commit 60b998a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions stock_manual_transfer/models/stock_manual_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ class StockManualTransfer(models.Model):
)

def action_validate(self):
if self.state != "draft":
return
route = self.route_id
if self.warehouse_id not in route.rule_ids.warehouse_id:
raise ValidationError(_("The selected route doesn't have configured rules on the selected warehouse."))
Expand Down

0 comments on commit 60b998a

Please sign in to comment.