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)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bojanz created an issue. See original summary.

jsacksick’s picture

Status: Active » Needs review
FileSize
4.19 KB

Haven't really tested it, but here's a first attempt.

jsacksick’s picture

Add tests to the patch, and fix a few issues.

jsacksick’s picture

bmcclure’s picture

@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!

bmcclure’s picture

Upon further investigation, the only parts which don't apply are the changes to ShipmentItemList and ShipmentItemListInterface. Rolling a new patch without those now.

bmcclure’s picture

Here'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.

jsacksick’s picture

Here's a new patch that uses the shipments entity reference field instead (Updated test, OrderGuard a OrderSubscriber).

bmcclure’s picture

Awesome, thanks for the patch! Testing now.

jsacksick’s picture

Rerolled patch against latest dev.

  • bojanz committed b240686 on 8.x-2.x authored by jsacksick
    Issue #2841809 by jsacksick, bmcclure, bojanz: Complete the workflow...
bojanz’s picture

Status: Needs review » Needs work

Updated 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.

bojanz’s picture

I 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.

  • bojanz committed c7faa4d on 8.x-2.x
    Issue #2841809 part II: Mark shipments as ready/shipped when the order...
bojanz’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.