Lasting internal shipment


Some internal shipments can last for more than a day. It is the case for shipments between warehouses. So we need a way to make internal shipment in to steps.
The duration of a shipment between two warehouses is not necessary the same as the reverse way. They could not use the same shipping service etc.


The duration of an internal shipment could be computed using a MatchMixin with criteria the warehouse of origin and the warehouse of destination.
The internal shipment must be altered in case there is a duration.
In this case the workflow must use an other path with one extra step shipped between assigned and done.
The moves should also be split on the waiting state into two sets where the From and the To is replaced by a Transit location respectively. (The unique list should be restored if it goes back to Draft.)
Of course the planned dates of each moves will be set according to the duration. Two new dates will be added to the shipment Planned Start Date and Effective Start Date (like for issue5560) and they will be automatically computed using the duration.

I think this is a design that has the advantage of keeping the internal shipment inside a warehouse simple. But it allows complex multi-warehouse setup.
The drawback is that in draft state, the forecast of the origin location will not be completly accurate but normally draft shipment should not stay long in draft.


I see a lot of use cases where the transit last less than a day, but the internal shipment is between different physical locations, so the extra step shipped will be also usefull to know that the goods are in transit.

So maybe we instead of splitting when the duration is greater than a day, we can split when there is any duration. Of curse, the planned dates will only be updated when the delta is greather than a day.

Yes, this sounds like a more flexible design.

While implementing, I think I will just compare Planned Date and Planned Start Date to split or not. Those fields are now dates but in case could be changed in date time. I think it is wrong to store the delay (redundant) or used the configured delay to make the choice.