Skip to content

Fix default purchase correction to use recorded location instead of org default (5536)#5537

Open
cassxw wants to merge 1 commit intorubyforgood:mainfrom
cassxw:5536-purchase-correction-default-location
Open

Fix default purchase correction to use recorded location instead of org default (5536)#5537
cassxw wants to merge 1 commit intorubyforgood:mainfrom
cassxw:5536-purchase-correction-default-location

Conversation

@cassxw
Copy link
Copy Markdown
Contributor

@cassxw cassxw commented Apr 13, 2026

Resolves #5536

Description

When correcting a purchase, the storage location dropdown was incorrectly defaulting to the organization's default storage location, instead of the location recorded on the existing purchase.

Root cause: The default_location helper in ApplicationHelper prioritized current_organization.default_storage_location before checking the source object's storage_location_id.

Fix: Reordered the logic to check the source object's storage_location_id first, falling back to org defaults only when no location is recorded.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Unit test added in spec/helpers/application_helper_spec.rb, verifying that default_location returns the source object's storage_location_id even when the organization has a different default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Purchases. On correction screen, location should default to the location on the existing purchase, not the default location for the org.

1 participant