[OBPIH-6515] Unify location search on outbound import with regular outbound creation#4808
Conversation
| const loadOutboundLocations = debounceLocationsFetch( | ||
| debounceTime, | ||
| minSearchLength, | ||
| null, | ||
| false, | ||
| false, | ||
| true, | ||
| false, | ||
| StockMovementDirection.OUTBOUND, | ||
| ); |
There was a problem hiding this comment.
I know this looks ugly and all of the values between minSearchLength and direction are the default values.
At first I thought to extract them from a destructed object but there would be a little to much work to change each instance of debounceLocationsFetch which is called accross the whole application.
Maybe we'll do it some other day 😉
There was a problem hiding this comment.
@awalkowiak what do you think about creating a tech debt ticket for moving all of the debonuceXYZFetch to the hook for debounce fetching? We can also refactor those methods to take an object as an argument instead of having those ugly positional arguments.
| export default { | ||
| INBOUND: 'INBOUND', | ||
| OUTBOUND: 'OUTBOUND', | ||
| }; |
There was a problem hiding this comment.
To unify this "enum" with the backend part, please add "INTERNAL"
This is how it looks on the backend:
INBOUND('Inbound'),
OUTBOUND('Outbound'),
INTERNAL('Internal')
There was a problem hiding this comment.
this is weird. I'm sure we've already had this enum on the frontend, but suddenly I can't find it anywhere.
| const loadOutboundLocations = debounceLocationsFetch( | ||
| debounceTime, | ||
| minSearchLength, | ||
| null, | ||
| false, | ||
| false, | ||
| true, | ||
| false, | ||
| StockMovementDirection.OUTBOUND, | ||
| ); |
There was a problem hiding this comment.
@awalkowiak what do you think about creating a tech debt ticket for moving all of the debonuceXYZFetch to the hook for debounce fetching? We can also refactor those methods to take an object as an argument instead of having those ugly positional arguments.
✨ Description of Change
Link to GitHub issue or Jira ticket: OBPIH-6515
Description:
The issue was that locations returned on import outbound workflow were a different set of locations than on regular outbound, the difference was that on regular outbound creation we send a request to locations api with
direction=OUTBOUNDparameter that was extracted from the url (for example when we are on page/openboxes/stockMovement/createOutbound?direction=OUTBOUND).To fix this issue I have added an additional optional parameter
directionto the fetch Locations service method where we can manually specify the stock movement direction, if it is not provided then the default behavior is to extract the direction parameter from the url like it worked before.📷 Screenshots & Recordings (optional)
📈 Test Plan
Description of test plan (if applicable):
✅ Quality Checks
[OBS-123]for Jira,[#0000]for GitHub, or[OBS-123, OBPIH-123]if there are multiple), or with[N/A]if not applicable