Skip to content

Add partial delivery feature #2187

Closed

Description

@tse-tarn-france

Is your feature request the result of a bug?
NO

Problem
When order is 10 parts and 5 are available, we would need to ship 5 immediatly and 5 later if needed, that's not possible at the moment :

partial_delivery

Suggested solution
Do not close the order when partial delivery, consider beeing allowed to ship in multiple batchs, like build order can be.

Describe alternatives you've considered
Not Applicable

Examples of other systems
Every commercial or industrial inventory system can do that, this is a "MUST HAVE"

Do you want to develop this?
If I can, I'd like to try, but please assign a more experimented contributor to help me :-)
When I'm familiar to Inventree I will be able to contribute alone :-)

Activity

  1. added
    enhancement
    on Oct 20, 2021
  2. matmair commented on Oct 20, 2021

    @matmair
    Member

    @SchrodingersGat would this be merged? I volunteer to assist @tse-tarn-france with the implementation.

  3. added this to the 0.6.0 milestone on Oct 20, 2021
  4. added
    order
    api
    on Oct 20, 2021
  5. SchrodingersGat commented on Oct 21, 2021

    @SchrodingersGat
    Member

    Yes would definitely support implementation of this feature. This has also been raised in a previous issue.

    Working out how to implement this cleanly would be the major impediment.

    I think that this would require the addition of a "Shipment" model. Multiple shipments can reference the same SalesOrder instance.

    Then, instead of stock items being allocated against a SalesOrder directly, they are allocated against a shipment.

    We would need to migrate any existing SalesOrder, so a single shipment would be created for any existing SalesOrder in the database.

    Shipments can then be "shipped" with any amount of stock. User simply has to select "add new shipment" on the sales order page.

    I'd like to stipulate that the implementation used only the API forms interface, rather than the (old) Django server side forms. Happy to provide pointers on this as the client side forms code is pretty complex.

    Feel free to ping me for any implementation discussions! I'd be really keen to see this feature added.

  6. afkiwers commented on Oct 21, 2021

    @afkiwers
    Contributor

    Just wondering if someone noticed that there seems to be an inconsistency with the prices in the table. The unit price uses a comma separator and the total price a dot as separator.

    image

  7. SchrodingersGat commented on Oct 21, 2021

    @SchrodingersGat
    Member

    @afkiwers well at least one person has ;) please split this out as a separate issue :)

  8. afkiwers commented on Oct 21, 2021

    @afkiwers
    Contributor

    Will do!

  9. modified the milestones: 0.6.0, 0.7.0 on Oct 21, 2021
  10. tse-tarn-france commented on Oct 21, 2021

    @tse-tarn-france
    Author

    Well, allocating stock to a shipment should be OK, but I think shipment for sale order should be treated as batch for build orders, I mean multiple shipments are however all linked to a sale order.

    So just let me know if I remain assigned to this as it seems a little bit tricky for a 1rst one :-)

    About dot or comas, as for excel and CSV it is not so easy maybe this could be part of parameters ?

    I don't know if it's a database parameter or just a display parameter ? using comas for separators in CSV is often a problem

  11. tse-tarn-france commented on Oct 21, 2021

    @tse-tarn-france
    Author

    Just to say, in some other implementation, 2nd and following shipments of a sale order are called "child of" 1rts shipment.

    So maybe it's not the sale order data to duplicate but the shipment data ? I think you best known Inventree achitecture to decide.

    Regards.

  12. matmair commented on Oct 23, 2021

    @matmair
    Member

    @tse-tarn-france I would simply add a Shipment model with ShipmentLines as a second model (just like Orders / OrderLines). An order (BO/SO) could just be extended to contain shipment information. Maybe as an own tab for orders.

  13. SchrodingersGat commented on Oct 24, 2021

    @SchrodingersGat
    Member

    I have been considering an implementation of this for a while - we would make good use of this at my work too.

    Some details below:

    Current Structure

    Here is a diagram of the current model structure related to the concept of a sales order:

    so_current

    Models

    Sales Order

    The SalesOrder model represents a single order of items going to a customer

    SalesOrderLineItem

    The SalesOrderLineItem model links a certain quantity of a Part instance to the outgoing SalesOrder

    SalesOrderAllocation

    The SalesOrderAllocation model allocates a certain quantity of a particular StockItem to a single SalesOrderLineItem

    Note that multiple SalesOrderAllocations can be made against a single SalesOrderLineItem

    Desired Structure

    The following implementation represents what I think would be the "simplest" structure that allows for multiple partial shipments and also retains the current workflow (as closely as possible).

    Shipment Model

    First, we add a new model Shipment which references the SalesOrder.

    so_w_shipment

    • When a new SalesOrder instance is created, a new Shipment instance is also created, and points to the new SalesOrder
    • Multiple Shipment can point to the same SalesOrder
    • Or, the SalesOrder can be fulfilled in a single Shipment

    Allocation

    Then, stock is allocated against a shipment, in addition to the line item:

    shipment_allocation

    There would be some back-end changes required, and a fair bit of work with the front-end allocation tables, but the end result would (I think) be pretty simple, and if the users did not want to split a sales order across multiple shipments then the process would not really change much from the current process.

    Required Steps

    • Add a new Shipment model
    • Add a "Shipment" field to the SalesOrderAllocation model
    • Create data migrations for existing sales orders, creating default shipments and updating existing allocations
    • Refactor functions for determination of whether a line item is completed
    • Update REST API
    • Re-write the sales order allocation table code (front-end javascript)

    Rather than charge ahead and implement this as above, I'd like to receive some input on whether this suggested approach makes sense to everyone. There may be some parts I have not explained exceptionally well, also.

  14. matmair commented on Oct 24, 2021

    @matmair
    Member

    @SchrodingersGat looks great! This would also allow us to add fulfillment tracking etc. in the future. The model should scale pretty well if implemented like this. We should def. test that this does not hit performance due to lookups.

    I do not know if hobbyists need shipments so maybe we should hide UI for this with a default False flag?

  15. SchrodingersGat commented on Oct 24, 2021

    @SchrodingersGat
    Member

    @tse-tarn-france this one will actually be pretty complex. I'll start a new PR for this myself and tag you so you can follow along!

  16. modified the milestones: 0.7.0, 0.6.0 on Oct 25, 2021
  17. matmair commented on Dec 4, 2021

    @matmair
    Member

    @tse-tarn-france changes are in master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

apienhancementorder

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions