Problem/Motivation

Currently, it is impossible to create a new shipment from the UI, when no order items are added to the order, because the shipment items field is required.

We should consider making the shipment items field not required to allow creating an incomplete shipment.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jsacksick created an issue. See original summary.

tbkot made their first commit to this issue’s fork.

tbkot’s picture

Status: Active » Needs review

@jsacksick now we can create a shipment without any items in it. An incomplete shipment has a label on the "Shipping information" card. Should we also add a guard to prevent orders from being completed if there are incomplete shipments?

jsacksick changed the visibility of the branch 3562222-allow-incomplete-shipments to hidden.

jsacksick’s picture

Issue tags: +Needs tests

I opened a different merge request with a different approach after discussing this with @rszrama.
The ShipmentAddModalForm is now trying to pack the order when the order doesn't reference a shipment yet.

The main problem I faced was the DefaultPacker not returning a ProposedShipment in case the order doesn't reference any shipment.
Instantiating a ProposedShipment without items wasn't supported and would crash so what I did was changing the constructor logic to allow not passing items.

I'm a bit concerned about the potential ramifications of the change... But let's see what happens with the tests.
We need additional tests coverage as well..

I ended up defining a new packer called "AdminPacker" that has a lower priority than the default packer and should only pack if the default packer didn't pack the order.
It applies if a certain flag is set on the order, the flag is set from the ShipmentAddModalForm.

  • jsacksick committed b3cea698 on 3.x authored by tbkot
    feat: #3562222 Allow incomplete shipments to be created in the modal
    
    By...

  • jsacksick committed 957c8fbb on 3.x
    Revert "feat: #3562222 Allow incomplete shipments to be created in the...

  • jsacksick committed 5f79d343 on 3.x
    feat: #3562222 Allow incomplete shipments to be created in the modal
    
    By...
jsacksick’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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