-
-
Notifications
You must be signed in to change notification settings - Fork 571
Bug-5152 Updates storage_location export to pull in all org items, no… #5210
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
base: main
Are you sure you want to change the base?
Bug-5152 Updates storage_location export to pull in all org items, no… #5210
Conversation
| def self.generate_csv_from_inventory(storage_locations, inventory) | ||
| all_items = inventory.all_items.uniq(&:item_id).sort_by(&:name) | ||
| additional_headers = all_items.map(&:name).uniq | ||
| def self.generate_csv_from_inventory(storage_locations, inventory, current_organization) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could get moved to just being an options hash, which is my general preference vs array of args. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dorner -- do you have an opinion on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use keyword arguments instead of an option hash.
|
FWIW, what we have now passes my functional testing. |
dorner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previous comments re hardcoded CSVs apply here as well.
| # Yes it's another full table scan, but it's a small dataset and product wants the exports to consistently include all items (active, inactive, etc). | ||
| # This means we have to look for inactive items or items without inventory. | ||
| # note the remapping of item.id to item_id is to enable the uniq call to happen once across the two arrays. | ||
| all_organization_items = current_organization.items.select("DISTINCT ON (LOWER(name)) items.name, items.id as item_id").order("LOWER(name) ASC") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a feature that should be built into the View::Inventory class. It's come up a few times. We should be able to specify "include non inventory items" in the all_items method.
…t just ones with inventory
Resolves #5202 partially
Description
Updates the Storage Location export to include all products, not just inventoried ones. This means brining in inactive products, not just ones with 0 inv.
Type of change
Bug fix (non-breaking change which fixes an issue)
How Has This Been Tested?
Screenshots
storage_location_after_fix.csv
storage_location_before_fix.csv