Closed racke closed 8 years ago
The description in the pod for the primary key already suggests that shipments_id
ought to be included in the PK - adding it now.
For the quantity
column we should probably override insert
to check that the total quantity shipped does not exceed the value in Orderline
. There is of course a potential race condition here if two inserts happen simultaneously but I think it is a good idea to try to prevent this. @racke thoughts?
How about also adding a boolean partial_shipment
flag to OrderlinesShipment
?
Yes on partial_shipment
.
I'm not sure if the quantity check is a good idea. If this information comes from ERP, we want to capture that even if the quantity might be inconsistent.
We also need to capture the ERP delivery order id.
Good point regarding data from ERP and quantity though perhaps at least a warning should be issued?
Yes, I'm fine with a warning.
I'm having second thoughts about warning since this would be new behaviour. I think we have to choose between quietly accepting whatever we are given or throw an exception so for now there will be no warning or exception.
As per IRC discussion partial_shipment
will be a method rather than an attribute. We can simply check whether shipped quantity is less than ordered quantity.
Currently partial shipments are not possible.
OrderlinesShipping has: