agritheory / beam

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

[demand] Create / document decision matrix for updating demanded inventory #108

Closed agritheory closed 1 month ago

agritheory commented 2 months ago

Currently there are three documents that can remove inventory demand: Stock Entry, Delivery Note and Sales Invoice (with 'Update Stock' checked). This code needs to be added to the demand feature branch and would be best served with a TDD approach since manually executing or evaporating stock transaction is onerous. These documents need to reconcile the demanding Sales Order or Work Order and their satisfaction. There's a subcontracting workflow that also needs to be tested but it will likely be solved with listening on Stock Entries.

The first step for this issue should to design a decision matrix, like the one we've spec'd for Handling Units. Both of these could benefit from additional clarity about the Stock Entry type, since that does change the behavior.

In prose, I think we should specify it like this:

When a Stock Entry with a purpose of "Transfer" is submitted, update demand for that Item, subject to warehouse filtering, increasing demand for target warehouse, decreasing demand in source warehouse.

When a Stock Entry with a purpose of "Transfer" is cancelled, update demand for that Item, subject to warehouse filtering, decreasing demand for target warehouse, increasing demand in source warehouse.

With this laid out, the test regime also becomes clear and we can align the desired outcome.

Alchez commented 1 month ago

@agritheory are you looking for something like this? Or in a different format?

Doctype Action Source Warehouse Demand Target Warehouse Demand Stock Transaction Type
Delivery Note Submit Increase
Delivery Note Cancel Decrease
Sales Invoice Submit Increase Sales Fulfillment
Sales Invoice Cancel Decrease Sales Fulfillment
Sales Invoice Submit Decrease Sales Return
Sales Invoice Cancel Increase Sales Return
Stock Entry Submit Decrease Increase Material Transfer for Manufacture
Stock Entry Cancel Increase Decrease Material Transfer for Manufacture
Stock Entry Submit Decrease Material Issue
Stock Entry Cancel Increase Material Issue
Stock Entry Submit Increase Material Receipt
Stock Entry Cancel Decrease Material Receipt
Stock Entry Submit Decrease Increase Material Transfer
Stock Entry Cancel Increase Decrease Material Transfer
Stock Entry Submit Decrease Increase Manufacture
Stock Entry Cancel Increase Decrease Manufacture
Stock Entry Submit Decrease Increase Repack
Stock Entry Cancel Increase Decrease Repack
Stock Entry Submit Decrease Increase Send to Subcontractor
Stock Entry Cancel Increase Decrease Send to Subcontractor
Purchase Invoice Submit Increase Purchase Receipt
Purchase Invoice Cancel Decrease Purchase Receipt
Purchase Invoice Submit Decrease Purchase Return
Purchase Invoice Cancel Increase Purchase Return
Purchase Receipt Submit Increase
Purchase Receipt Cancel Decrease
Stock Reconciliation Submit Adjustment
Stock Reconciliation Cancel Adjustment
agritheory commented 1 month ago

@Alchez That looks good. I think we can build out the function using this as the base. It should exposed in hooks the same way that other BEAM actions are.