2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-16 12:05:53 +00:00

Merge pull request #2446 from SchrodingersGat/so-allocation-quantity

Calculate how many items to assign to sales order
This commit is contained in:
Oliver
2021-12-11 01:08:21 +11:00
committed by GitHub

View File

@ -1658,7 +1658,7 @@ function allocateStockToSalesOrder(order_id, line_items, options={}) {
var available = Math.max((data.quantity || 0) - (data.allocated || 0), 0); var available = Math.max((data.quantity || 0) - (data.allocated || 0), 0);
// Remaining quantity to be allocated? // Remaining quantity to be allocated?
var remaining = opts.quantity || available; var remaining = Math.max(line_item.quantity - line_item.shipped - line_item.allocated, 0);
// Maximum amount that we need // Maximum amount that we need
var desired = Math.min(available, remaining); var desired = Math.min(available, remaining);