2
0
mirror of https://github.com/frappe/books.git synced 2024-11-08 14:50:56 +00:00

fix: stock validation issue

- future stock check was incorrect
This commit is contained in:
18alantom 2023-05-11 11:04:15 +05:30 committed by Alan
parent afe04cccaf
commit 5ea8a09615

View File

@ -180,14 +180,13 @@ export class StockManager {
}
const quantityRemaining = quantityBefore - details.quantity;
if (quantityAfter < quantityRemaining) {
const futureQuantity = quantityRemaining + quantityAfter;
if (futureQuantity < 0) {
throw new ValidationError(
[
t`Insufficient Quantity.`,
t`Transfer will cause future entries to have negative stock.`,
t`Additional quantity (${
quantityAfter - quantityRemaining
}) required${batchMessage} to make outward transfer of item ${
t`Additional quantity (${-futureQuantity}) required${batchMessage} to make outward transfer of item ${
details.item
} from ${details.fromLocation} on ${formattedDate}`,
].join('\n')