agritheory / beam

General Purpose 2D barcode scanning for ERPNext
https://agritheory.com/documentation/beam/
Other
20 stars 9 forks source link

Ignore cancelled Stock Ledger Entries in `get_handling_unit` #65

Closed agritheory closed 9 months ago

agritheory commented 10 months ago

In this example we are receiving 40 units of Cocoplum.

Item Warehouse Handling Unit Quantity
Cocoplum Storeroom 123 40 Ea

For the next transactions we will transfer 16 units to a WIP warehouse in a Material Transfer for Manufacture Stock Entry.

Item Warehouse Handling Unit Quantity
Cocoplum Kitchen 456 16 Ea

The remaining quantity of the original handling unit should show as 24 units.

Item Warehouse Handling Unit Quantity
Cocoplum Storeroom 123 24 Ea

At this point we transfer 6 units of that original handling unit to an arbitrary warehouse with a Material Transfer Stock Entry.

Item Warehouse Handling Unit Quantity
Cocoplum Other Warehouse 789 6 Ea

The remaining quantity of the original handling unit should show as 18 units.

Item Warehouse Handling Unit Quantity
Cocoplum Storeroom 123 18 Ea

If either Stock Entry is Cancelled, there's an issue with how we realistically re-combine the units.

If we cancel the Material Transfer for Manufacture Stock Entry we would expect to see:

Item Warehouse Handling Unit Quantity
Cocoplum Storeroom 456 -16 Ea
Item Warehouse Handling Unit Quantity
Cocoplum Storeroom 123 34 Ea

This is problematic since the qty 16 handling unit is labelled with a ID that doesn't work - scanning "456" will return to results.

The right thing to do I think depends on the transaction, but it boils down to "should we make a new handling unit in this case or not".

agritheory commented 9 months ago

@federicocalvo @fproldan