2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00

refactor: batch-wise stock availability validation

This commit is contained in:
akshayitzme 2023-02-17 15:30:44 +05:30
parent 1d188151e8
commit ec31a3ba65

View File

@ -132,15 +132,17 @@ export class StockManager {
return;
}
const ifItemHasBatchNumber = await this.fyo.getValue(
const isItemHasBatchNumber = await this.fyo.getValue(
'Item',
details.item,
'hasBatchNumber'
);
if (!isItemHasBatchNumber) return;
const date = details.date.toISOString();
const formattedDate = this.fyo.format(details.date, 'Datetime');
if (ifItemHasBatchNumber) {
if (!details.batchNumber) {
throw new ValidationError(
t`Please enter Batch Number for ${details.item}`
@ -171,7 +173,6 @@ export class StockManager {
);
}
}
}
async #validateStockAvailability(details: SMIDetails) {
if (!details.fromLocation) {