Make shipment reference writeable until packed

When manually preparing a label for a carrier, usually I prepare the goods and the package first:
Assign goods, then pick the goods.

In case a module for automatic creation of a carrier label/reference number you have to pack the package, then “Create Shipping for Packages”. That is when the reference number is created and stored in the reference field (of the shipment).

It seems like the right place to create the label after the package exists, like it is done in the workflow where a module exists to create the label.

However in the manual workflow I have noticed that the reference field becomes read-only after Draft state. In this stage of the process the label usually has not been created manually through a web interface of the carrier. Then there is no way to store the number.

I would like to ask if there is any reason why the reference state of the shipment becomes read-only after draft state, and if there is none I would propose making the reference state writeable as late as possible, until picked state.

Then we need a consistent behavior also for the packages reference number, but this is the next issue.

The reference field on shipment was added with such state modules/stock: ec5faa79720d
But I think it does not align with the other reference fields (like on sale or purchase). So I think it should not be readonly for any state by default. But with the stock_package_shipping module it become readonly when a carrier is set (like the shipping_reference on package).

I agree

It seems like reference is not an ideal name for this field in its current usage.
I believe something like tracking_nr describes the current usage of the field better.

What I do is use Shipping description to put things like customer PO number, or sales number, so that they can check on the carrier label what they are receiving. This field is quite similar to reference in sale or in invoice for me, also it is written to the label.

I checked customer shipment nr 1 in demo. There stock_package_shipping module is not activated nor is carrier module. The state is Waiting. The reference field is read-only.

I think the behavior to hide “Create shipping for packages” button if reference field is filled is good enough, and then we can leave the field as writeable from draft to picked state.

This is our standard. External identifier for document is always named reference.

I used “should”.

No because once the shipping reference has been generated it should not be modified. And this is generated by the carrier selected.

But carrier does not have the shipping service as obligatory.
In this case it is possible to have a carrier selected, but no shipping service method to fill the reference.

What is the purpose to have a carrier, without the shipping service filled?

For example I use carrier as a way to know how a customer wishes to receive the goods, with which carrier I should generate a label, to which carrier I should hand the package and after the shipment has been shipped to know with which carrier I should track the reference number.

In this case we can check if carrier has shipping service method filled, then we set the reference as read-only starting with wait state.
In other cases we set the field to be read-only when it reaches done state.
@ced Ok with you?

Next is also the package reference number writing.

OK then it should be readonly when there is a carrier with a shipping service.

No I would make it readonly when done or packed.

I would never make it readonly like other reference fields.

Yes the shipping_reference on package should follow the same rules.

Ok.
From packed should it be allowed to go back to picked in this case?

Even better.

Yes I think it is good to be able to clear the references in case of mistake.