Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Assume that the order is using either a order_fulfillment or a order_fulfillment_validation workflow.
We need the following:
1) When the order is placed, if the destination state is "fulfillment", finalize the shipments ("ready" state).
Otherwise the order will go to validation and the shipments will stay as draft for further editing.
2) Prevent the order from being validated if the shipments aren't ready (guard)
3) Prevent an order from being fulfilled if the shipments haven't been shipped. (guard)
Comments
Comment #2
jsacksick CreditAttribution: jsacksick at Centarro for Adapt commentedHaven't really tested it, but here's a first attempt.
Comment #3
jsacksick CreditAttribution: jsacksick at Centarro for Adapt commentedAdd tests to the patch, and fix a few issues.
Comment #4
jsacksick CreditAttribution: jsacksick at Centarro for Adapt commentedComment #5
bmcclure CreditAttribution: bmcclure as a volunteer and at Top Floor commented@jsacksick:
The patch doesn't apply to the latest dev version of commerce_shipping. Do you know if it's still needed, and if so, do you think it'd be simply to roll a new patch? I'm starting to investigate a bit now to see how difficult it may be but figured I'd put the question here as well. Thanks!
Comment #6
bmcclure CreditAttribution: bmcclure as a volunteer and at Top Floor commentedUpon further investigation, the only parts which don't apply are the changes to ShipmentItemList and ShipmentItemListInterface. Rolling a new patch without those now.
Comment #7
bmcclure CreditAttribution: bmcclure as a volunteer and at Top Floor commentedHere's a re-rolled patch, the only difference is it doesn't modify the classes mentioned in my previous comment, since they are already modified.
Comment #8
jsacksick CreditAttribution: jsacksick at Centarro for Adapt commentedHere's a new patch that uses the shipments entity reference field instead (Updated test, OrderGuard a OrderSubscriber).
Comment #9
bmcclure CreditAttribution: bmcclure as a volunteer and at Top Floor commentedAwesome, thanks for the patch! Testing now.
Comment #10
jsacksick CreditAttribution: jsacksick at Centarro for Adapt commentedRerolled patch against latest dev.
Comment #12
bojanz CreditAttribution: bojanz at Centarro for Adapt commentedUpdated the tests and converted half of the patch (the non-guard part). That solves #1 from the issue summary.
The order guards (and relevant test portion) need to go in along with a transition form for shipments.
Comment #13
bojanz CreditAttribution: bojanz at Centarro commentedI tried to add the transition form to the summary shown on the order view page, but the results were not optimal.
We end up with several rows of buttons (one row per shipment + the order transition row), and it's not clear why a relevant order transition button is missing until a shipment one is clicked.
Discussed it with Ryan and Matt and we agreed that the ideal UX is this:
1) Have the shipment state transition form on the (currently non-existant) shipments tab.
2) Have the order transition buttons always available (no guard), leading to a form that allows you to confirm that all shipments will be marked as sent
This will require #2786971: Support third-party settings on transitions to be done in state machine.
Our stop-gap solution pre-beta1 is to skip the guard, add code that will mark all shipments as ready/sent when the order is validated/fulfilled.
Comment #15
bojanz CreditAttribution: bojanz at Centarro commented