agritheory / beam

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

fix: add manufacturing transfers to handling unit #51

Closed HKuz closed 10 months ago

HKuz commented 11 months ago

Addresses #49

This bug was partially due to user error - the handling unit only attaches to an item when the item is 'scanned' or is manually linked in the Edit form for the item. This PR also adds code for when a HU is present, if the qty being moved is less than the HU's stock_qty (within qty field's precision number of decimals accuracy), it generates a new HU for the transferred qty. There are a few tweaks to the over-consumption validation - the main one is to use transfer_qty field for Stock Entries - digging into the code, actual_qty is what is available at the source warehouse as of the latest SLE and may be much more than what's being moved. (E.g - a 'Material Transfer for Manufacture' moves a 1lb of butter out of the Refrigerator for pie filling, but actual_qty is the 50lbs that's available in the fridge).

I also commented a conversion in get_handling_unit - it was converting parchment paper back to Box units (vs. stock UOM Nos). The query is summing actual_qty off of SLEs for the stock_qty field, so it's already in stock_uoms.

For testing, I checked the following scenarios and all worked as expected:

agritheory commented 11 months ago

For testing, I checked the following scenarios and all worked as expected:

Transferred half the required materials for Gooseberry Pie Filling in 'Material Transfer for Manufacture' SE Transferred the other half of required materials for Gooseberry Pie Filling in 'Material Transfer for Manufacture' SE Created all Gooseberry Pie Filling in 'Manufacture' SE Moved all Pie Crust required materials in 'Material Transfer for Manufacture' SE, create all pie crusts in 'Manufacture' SE Moved filling/crusts and created Gooseberry Pie Created Delivery Note for Gooseberry Pie

This test case or an equivalent one that tests correcting netting of quantities should be in the test suite. The specifics are in conflict with the use case that Federico brought up the other day. I'll open a ticket related to that separately.