Add foreign key and handling for stock location deletion to customer returns - #6309
Merged
Merged
Conversation
mamhoff
force-pushed
the
customer-return-dependent
branch
from
July 27, 2025 21:14
a778094 to
a73417c
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6309 +/- ##
=======================================
Coverage 89.31% 89.31%
=======================================
Files 959 959
Lines 20119 20119
=======================================
Hits 17970 17970
Misses 2149 2149 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
adammathys
approved these changes
Jul 28, 2025
tvdeyen
approved these changes
Aug 5, 2025
It's always been mandatory, so we can remove both the `optional: true` and the presence validation.
Otherwise we can't be sure the stock location exists.
We have a foreign key here, but no `has_many` declaration. Because customer returns are important, and potentially carry return items, this needs to be present so we can present the user with a good error message when trying to delete a stock location with existing customer returns.
tvdeyen
force-pushed
the
customer-return-dependent
branch
from
August 5, 2025 12:03
a73417c to
3557e7a
Compare
tvdeyen
enabled auto-merge
August 5, 2025 12:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a foreign key constraint such that all customer returns have a stock location ID that refers to an existing stock location. It also restricts deleting stock locations with customer returns present, as customer returns frequently also hold information about reimbursements and generally reflect real-life occurrences.
In order to provide an o-kay interface deleting a stock location with customer returns present:
(This is the legacy admin interface,
solidus_admindoes not have a button for deleting stock locations).Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed: