Skip to content
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

Prevent the need for source selection when shipping via Admin #127

Conversation

convenient
Copy link
Contributor

@convenient convenient commented Oct 10, 2023

Attempt to resolve #121

In that issue it is reported that if the products stock is all the way to 0 you cannot ship the order as you cannot select a source.

Conceptually, the source is already selected when the order is created so this entire screen of source selection before creating a shipment does not seem necessary to me. This screen is injected in two places

Ship button URL replacement

https://github.com/magento/inventory/blob/062205f54be17ad70aa341f63fd5037b61a4c7d8/InventoryShippingAdminUi/Block/Adminhtml/Order/View/ShipButton.php#L63-L77

This block is injected to swap out the url so that you go straight to source selection when you hit "ship". this is solved by removing the block.

Observer to force redirect when starting a new shipment

There is an observer on controller_action_predispatch_adminhtml_order_shipment_new which will force a redirect to the source selection screen

https://github.com/magento/inventory/blob/062205f54be17ad70aa341f63fd5037b61a4c7d8/InventoryShippingAdminUi/Observer/NewShipmentLoadBefore.php#L86-L92

Disabling this observer allows you to go straight to the order ship page to create a shipment.

Before

Screen.Recording.2023-10-10.at.15.21.44.mov

Hitting "ship" takes you to the source selection screen, to either

  1. Make a choice that doesnt really even make sense or do anything (because the inventory has already been deducated on placement)
  2. Be stuck, if the quantity is at 0

After

Screen.Recording.2023-10-10.at.15.33.47.mov

Hitting "ship" takes you to the shipment screen

  • You can place a shipment for the items you want
  • It does say "default" source selected, but as no further deduction happens this seems okay.

Checklist

  • Pull request has a meaningful description of its purpose, include affected Magento versions if it is a bug.
  • All commits are accompanied by meaningful commit messages
  • Tests have been ran / updated (see ./dev/README.md for how to run tests)

src/etc/module.xml Outdated Show resolved Hide resolved
src/view/adminhtml/layout/sales_order_view.xml Outdated Show resolved Hide resolved
@convenient convenient merged commit d8db36b into master Dec 7, 2023
2 checks passed
@convenient convenient deleted the issue-69-issue-121-allow-shipping-via-admin-panel-without-source-selection branch December 7, 2023 10:50
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.

I cannot bypass source selection view on order shipment
2 participants