diff --git a/backend/database/bespoke.ts b/backend/database/bespoke.ts index 87c3ab7b..394c64bd 100644 --- a/backend/database/bespoke.ts +++ b/backend/database/bespoke.ts @@ -138,7 +138,7 @@ export class BespokeQueries { location?: string, fromDate?: string, toDate?: string, - batchNumber?: string + batch?: string ): Promise { const query = db.knex!(ModelNameEnum.StockLedgerEntry) .sum('quantity') @@ -148,8 +148,8 @@ export class BespokeQueries { query.andWhere('location', location); } - if (batchNumber) { - query.andWhere('batchNumber', batchNumber); + if (batch) { + query.andWhere('batch', batch); } if (fromDate) { diff --git a/fyo/core/dbHandler.ts b/fyo/core/dbHandler.ts index 0193aea4..070c6118 100644 --- a/fyo/core/dbHandler.ts +++ b/fyo/core/dbHandler.ts @@ -313,7 +313,7 @@ export class DatabaseHandler extends DatabaseBase { location?: string, fromDate?: string, toDate?: string, - batchNumber?: string + batch?: string ): Promise { return (await this.#demux.callBespoke( 'getStockQuantity', @@ -321,7 +321,7 @@ export class DatabaseHandler extends DatabaseBase { location, fromDate, toDate, - batchNumber + batch )) as number | null; } diff --git a/models/baseModels/Invoice/Invoice.ts b/models/baseModels/Invoice/Invoice.ts index 22e85dee..b929c117 100644 --- a/models/baseModels/Invoice/Invoice.ts +++ b/models/baseModels/Invoice/Invoice.ts @@ -11,7 +11,7 @@ import { import { DEFAULT_CURRENCY } from 'fyo/utils/consts'; import { ValidationError } from 'fyo/utils/errors'; import { addItem, getExchangeRate, getNumberSeries } from 'models/helpers'; -import { validateBatchNumber } from 'models/inventory/helpers'; +import { validateBatch } from 'models/inventory/helpers'; import { InventorySettings } from 'models/inventory/InventorySettings'; import { StockTransfer } from 'models/inventory/StockTransfer'; import { Transactional } from 'models/Transactional/Transactional'; @@ -546,7 +546,7 @@ export abstract class Invoice extends Transactional { const item = row.item; const quantity = row.stockNotTransferred; const trackItem = itemDoc.trackItem; - const batchNumber = row.batchNumber || null; + const batch = row.batch || null; let rate = row.rate as Money; if (this.exchangeRate && this.exchangeRate > 1) { @@ -562,7 +562,7 @@ export abstract class Invoice extends Transactional { quantity, location, rate, - batchNumber, + batch, }); } diff --git a/models/baseModels/InvoiceItem/InvoiceItem.ts b/models/baseModels/InvoiceItem/InvoiceItem.ts index b70acb1a..670bbc13 100644 --- a/models/baseModels/InvoiceItem/InvoiceItem.ts +++ b/models/baseModels/InvoiceItem/InvoiceItem.ts @@ -29,7 +29,7 @@ export abstract class InvoiceItem extends Doc { quantity?: number; transferQuantity?: number; unitConversionFactor?: number; - batchNumber?: string; + batch?: string; tax?: string; stockNotTransferred?: number; @@ -431,7 +431,7 @@ export abstract class InvoiceItem extends Doc { !(this.enableDiscounting && !!this.setItemDiscountAmount), itemDiscountPercent: () => !(this.enableDiscounting && !this.setItemDiscountAmount), - batchNumber: () => !this.fyo.singles.InventorySettings?.enableBatches, + batch: () => !this.fyo.singles.InventorySettings?.enableBatches, transferUnit: () => !this.fyo.singles.InventorySettings?.enableUomConversions, transferQuantity: () => diff --git a/models/baseModels/Item/Item.ts b/models/baseModels/Item/Item.ts index f9cd4658..513b41f8 100644 --- a/models/baseModels/Item/Item.ts +++ b/models/baseModels/Item/Item.ts @@ -19,7 +19,7 @@ export class Item extends Doc { trackItem?: boolean; itemType?: 'Product' | 'Service'; for?: 'Purchases' | 'Sales' | 'Both'; - hasBatchNumber?: boolean; + hasBatch?: boolean; formulas: FormulaMap = { incomeAccount: { @@ -124,7 +124,7 @@ export class Item extends Doc { this.itemType !== 'Product' || (this.inserted && !this.trackItem), barcode: () => !this.fyo.singles.InventorySettings?.enableBarcodes, - hasBatchNumber: () => + hasBatch: () => !(this.fyo.singles.InventorySettings?.enableBatches && this.trackItem), uomConversions: () => !this.fyo.singles.InventorySettings?.enableUomConversions, @@ -134,6 +134,6 @@ export class Item extends Doc { unit: () => this.inserted, itemType: () => this.inserted, trackItem: () => this.inserted, - hasBatchNumber: () => this.inserted, + hasBatch: () => this.inserted, }; } diff --git a/models/index.ts b/models/index.ts index c12eb802..e8407771 100644 --- a/models/index.ts +++ b/models/index.ts @@ -26,14 +26,14 @@ import { ShipmentItem } from './inventory/ShipmentItem'; import { StockLedgerEntry } from './inventory/StockLedgerEntry'; import { StockMovement } from './inventory/StockMovement'; import { StockMovementItem } from './inventory/StockMovementItem'; -import { BatchNumber } from './baseModels/BatchNumber/BatchNumber'; +import { Batch } from './inventory/Batch'; export const models = { Account, AccountingLedgerEntry, AccountingSettings, Address, - BatchNumber, + Batch, Defaults, Item, JournalEntry, diff --git a/models/baseModels/BatchNumber/BatchNumber.ts b/models/inventory/Batch.ts similarity index 85% rename from models/baseModels/BatchNumber/BatchNumber.ts rename to models/inventory/Batch.ts index 0df86c78..27a04157 100644 --- a/models/baseModels/BatchNumber/BatchNumber.ts +++ b/models/inventory/Batch.ts @@ -3,7 +3,7 @@ import { ListViewSettings, } from 'fyo/model/types'; -export class BatchNumber extends Doc { +export class Batch extends Doc { static getListViewSettings(): ListViewSettings { return { columns: ["name", "expiryDate", "manufactureDate"], diff --git a/models/inventory/StockLedgerEntry.ts b/models/inventory/StockLedgerEntry.ts index 49e3ec38..d64c6756 100644 --- a/models/inventory/StockLedgerEntry.ts +++ b/models/inventory/StockLedgerEntry.ts @@ -10,5 +10,5 @@ export class StockLedgerEntry extends Doc { location?: string; referenceName?: string; referenceType?: string; - batchNumber?: string; + batch?: string; } diff --git a/models/inventory/StockManager.ts b/models/inventory/StockManager.ts index 8a914400..e000d4da 100644 --- a/models/inventory/StockManager.ts +++ b/models/inventory/StockManager.ts @@ -132,7 +132,7 @@ export class StockManager { const date = details.date.toISOString(); const formattedDate = this.fyo.format(details.date, 'Datetime'); - const batchNumber = details.batchNumber || undefined; + const batch = details.batch || undefined; let quantityBefore = (await this.fyo.db.getStockQuantity( @@ -140,14 +140,14 @@ export class StockManager { details.fromLocation, undefined, date, - batchNumber + batch )) ?? 0; if (this.isCancelled) { quantityBefore += details.quantity; } - const batchNumberMessage = !!batchNumber ? t` in Batch ${batchNumber}` : ''; + const batchMessage = !!batch ? t` in Batch ${batch}` : ''; if (quantityBefore < details.quantity) { throw new ValidationError( @@ -155,7 +155,7 @@ export class StockManager { t`Insufficient Quantity.`, t`Additional quantity (${ details.quantity - quantityBefore - }) required${batchNumberMessage} to make outward transfer of item ${ + }) required${batchMessage} to make outward transfer of item ${ details.item } from ${details.fromLocation} on ${formattedDate}`, ].join('\n') @@ -167,7 +167,7 @@ export class StockManager { details.fromLocation, details.date.toISOString(), undefined, - batchNumber + batch ); if (quantityAfter === null) { @@ -183,7 +183,7 @@ export class StockManager { t`Transfer will cause future entries to have negative stock.`, t`Additional quantity (${ quantityAfter - quantityRemaining - }) required${batchNumberMessage} to make outward transfer of item ${ + }) required${batchMessage} to make outward transfer of item ${ details.item } from ${details.fromLocation} on ${formattedDate}`, ].join('\n') @@ -210,7 +210,7 @@ class StockManagerItem { referenceType: string; fromLocation?: string; toLocation?: string; - batchNumber?: string; + batch?: string; stockLedgerEntries?: StockLedgerEntry[]; @@ -225,7 +225,7 @@ class StockManagerItem { this.toLocation = details.toLocation; this.referenceName = details.referenceName; this.referenceType = details.referenceType; - this.batchNumber = details.batchNumber; + this.batch = details.batch; this.fyo = fyo; } @@ -278,7 +278,7 @@ class StockManagerItem { date: this.date, item: this.item, rate: this.rate, - batchNumber: this.batchNumber || null, + batch: this.batch || null, quantity, location, referenceName: this.referenceName, diff --git a/models/inventory/StockMovement.ts b/models/inventory/StockMovement.ts index d539ec44..7d05429c 100644 --- a/models/inventory/StockMovement.ts +++ b/models/inventory/StockMovement.ts @@ -15,7 +15,7 @@ import { import { LedgerPosting } from 'models/Transactional/LedgerPosting'; import { ModelNameEnum } from 'models/types'; import { Money } from 'pesa'; -import { validateBatchNumber } from './helpers'; +import { validateBatch } from './helpers'; import { StockMovementItem } from './StockMovementItem'; import { Transfer } from './Transfer'; import { MovementType } from './types'; @@ -51,7 +51,7 @@ export class StockMovement extends Transfer { async validate() { await super.validate(); this.validateManufacture(); - await validateBatchNumber(this); + await validateBatch(this); } validateManufacture() { @@ -115,7 +115,7 @@ export class StockMovement extends Transfer { item: row.item!, rate: row.rate!, quantity: row.quantity!, - batchNumber: row.batchNumber!, + batch: row.batch!, fromLocation: row.fromLocation, toLocation: row.toLocation, })); diff --git a/models/inventory/StockMovementItem.ts b/models/inventory/StockMovementItem.ts index 12e16534..36318b21 100644 --- a/models/inventory/StockMovementItem.ts +++ b/models/inventory/StockMovementItem.ts @@ -31,7 +31,7 @@ export class StockMovementItem extends Doc { rate?: Money; amount?: Money; parentdoc?: StockMovement; - batchNumber?: string; + batch?: string; get isIssue() { return this.parentdoc?.movementType === MovementType.MaterialIssue; @@ -235,7 +235,7 @@ export class StockMovementItem extends Doc { }; override hidden: HiddenMap = { - batchNumber: () => !this.fyo.singles.InventorySettings?.enableBatches, + batch: () => !this.fyo.singles.InventorySettings?.enableBatches, transferUnit: () => !this.fyo.singles.InventorySettings?.enableUomConversions, transferQuantity: () => diff --git a/models/inventory/StockTransfer.ts b/models/inventory/StockTransfer.ts index 18b28896..1d8bb97f 100644 --- a/models/inventory/StockTransfer.ts +++ b/models/inventory/StockTransfer.ts @@ -15,7 +15,7 @@ import { addItem, getLedgerLinkAction, getNumberSeries } from 'models/helpers'; import { LedgerPosting } from 'models/Transactional/LedgerPosting'; import { ModelNameEnum } from 'models/types'; import { Money } from 'pesa'; -import { validateBatchNumber } from './helpers'; +import { validateBatch } from './helpers'; import { StockTransferItem } from './StockTransferItem'; import { Transfer } from './Transfer'; @@ -83,7 +83,7 @@ export abstract class StockTransfer extends Transfer { item: row.item!, rate: row.rate!, quantity: row.quantity!, - batchNumber: row.batchNumber!, + batch: row.batch!, fromLocation, toLocation, }; @@ -154,7 +154,7 @@ export abstract class StockTransfer extends Transfer { override async validate(): Promise { await super.validate(); - await validateBatchNumber(this); + await validateBatch(this); } static getActions(fyo: Fyo): Action[] { diff --git a/models/inventory/StockTransferItem.ts b/models/inventory/StockTransferItem.ts index 2c5c2ccc..ec42ca29 100644 --- a/models/inventory/StockTransferItem.ts +++ b/models/inventory/StockTransferItem.ts @@ -26,7 +26,7 @@ export class StockTransferItem extends Doc { amount?: Money; description?: string; hsnCode?: number; - batchNumber?: string; + batch?: string; formulas: FormulaMap = { description: { @@ -207,7 +207,7 @@ export class StockTransferItem extends Doc { }; override hidden: HiddenMap = { - batchNumber: () => !this.fyo.singles.InventorySettings?.enableBatches, + batch: () => !this.fyo.singles.InventorySettings?.enableBatches, transferUnit: () => !this.fyo.singles.InventorySettings?.enableUomConversions, transferQuantity: () => diff --git a/models/inventory/helpers.ts b/models/inventory/helpers.ts index e1b6bdba..ba1d22a6 100644 --- a/models/inventory/helpers.ts +++ b/models/inventory/helpers.ts @@ -7,43 +7,43 @@ import { StockMovementItem } from './StockMovementItem'; import { StockTransfer } from './StockTransfer'; import { StockTransferItem } from './StockTransferItem'; -export async function validateBatchNumber( +export async function validateBatch( doc: StockMovement | StockTransfer | Invoice ) { for (const row of doc.items ?? []) { - await validateItemRowBatchNumber(row); + await validateItemRowBatch(row); } } -async function validateItemRowBatchNumber( +async function validateItemRowBatch( doc: StockMovementItem | StockTransferItem | InvoiceItem ) { const idx = doc.idx ?? 0 + 1; const item = doc.item; - const batchNumber = doc.batchNumber; + const batch = doc.batch; if (!item) { return; } - const hasBatchNumber = await doc.fyo.getValue( + const hasBatch = await doc.fyo.getValue( ModelNameEnum.Item, item, - 'hasBatchNumber' + 'hasBatch' ); - if (!hasBatchNumber && batchNumber) { + if (!hasBatch && batch) { throw new ValidationError( [ - doc.fyo.t`Batch Number set for row ${idx}.`, + doc.fyo.t`Batch set for row ${idx}.`, doc.fyo.t`Item ${item} is not a batched item`, ].join(' ') ); } - if (hasBatchNumber && !batchNumber) { + if (hasBatch && !batch) { throw new ValidationError( [ - doc.fyo.t`Batch Number not set for row ${idx}.`, + doc.fyo.t`Batch not set for row ${idx}.`, doc.fyo.t`Item ${item} is a batched item`, ].join(' ') ); diff --git a/models/inventory/tests/helpers.ts b/models/inventory/tests/helpers.ts index df8dde60..245d859d 100644 --- a/models/inventory/tests/helpers.ts +++ b/models/inventory/tests/helpers.ts @@ -1,5 +1,5 @@ import { Fyo } from 'fyo'; -import { BatchNumber } from 'models/baseModels/BatchNumber/BatchNumber'; +import { Batch } from 'models/inventory/Batch'; import { ModelNameEnum } from 'models/types'; import { StockMovement } from '../StockMovement'; import { StockTransfer } from '../StockTransfer'; @@ -27,7 +27,7 @@ type Transfer = { item: string; from?: string; to?: string; - batchNumber?: string; + batch?: string; quantity: number; rate: number; }; @@ -36,26 +36,22 @@ interface TransferTwo extends Omit { location: string; } -export function getItem( - name: string, - rate: number, - hasBatchNumber: boolean = false -) { - return { name, rate, trackItem: true, hasBatchNumber }; +export function getItem(name: string, rate: number, hasBatch: boolean = false) { + return { name, rate, trackItem: true, hasBatch }; } -export async function getBatchNumber( - schemaName: ModelNameEnum.BatchNumber, - batchNumber: string, +export async function getBatch( + schemaName: ModelNameEnum.Batch, + batch: string, expiryDate: Date, manufactureDate: Date, fyo: Fyo -): Promise { +): Promise { const doc = fyo.doc.getNewDoc(schemaName, { - batchNumber, + batch, expiryDate, manufactureDate, - }) as BatchNumber; + }) as Batch; return doc; } @@ -87,7 +83,7 @@ export async function getStockMovement( item, from: fromLocation, to: toLocation, - batchNumber, + batch, quantity, rate, } of transfers) { @@ -95,7 +91,7 @@ export async function getStockMovement( item, fromLocation, toLocation, - batchNumber, + batch, rate, quantity, }); diff --git a/models/inventory/tests/testBatches.spec.ts b/models/inventory/tests/testBatches.spec.ts index 4fed9ce7..cba94ecf 100644 --- a/models/inventory/tests/testBatches.spec.ts +++ b/models/inventory/tests/testBatches.spec.ts @@ -54,10 +54,10 @@ test('create dummy items, locations & batches', async (t) => { // Create Batches for (const batch of Object.values(batchMap)) { - const doc = fyo.doc.getNewDoc(ModelNameEnum.BatchNumber, batch); + const doc = fyo.doc.getNewDoc(ModelNameEnum.Batch, batch); await doc.sync(); - const exists = await fyo.db.exists(ModelNameEnum.BatchNumber, batch.name); + const exists = await fyo.db.exists(ModelNameEnum.Batch, batch.name); t.ok(exists, `${batch.name} exists`); } }); @@ -72,14 +72,14 @@ test('batched item, create stock movement, material receipt', async (t) => { item: itemMap.Pen.name, to: locationMap.LocationOne, quantity: 2, - batchNumber: batchMap.batchOne.name, + batch: batchMap.batchOne.name, rate, }, { item: itemMap.Pen.name, to: locationMap.LocationOne, quantity: 1, - batchNumber: batchMap.batchTwo.name, + batch: batchMap.batchTwo.name, rate, }, ], @@ -139,7 +139,7 @@ test('batched item, create stock movement, material receipt', async (t) => { test('batched item, create stock movement, material issue', async (t) => { const { rate } = itemMap.Pen; const quantity = 2; - const batchNumber = batchMap.batchOne.name; + const batch = batchMap.batchOne.name; const stockMovement = await getStockMovement( MovementType.MaterialIssue, @@ -148,7 +148,7 @@ test('batched item, create stock movement, material issue', async (t) => { { item: itemMap.Pen.name, from: locationMap.LocationOne, - batchNumber, + batch, quantity, rate, }, @@ -163,7 +163,7 @@ test('batched item, create stock movement, material issue', async (t) => { locationMap.LocationOne, undefined, undefined, - batchNumber + batch ), 0, 'batch one quantity transacted out' @@ -185,7 +185,7 @@ test('batched item, create stock movement, material issue', async (t) => { test('batched item, create stock movement, material transfer', async (t) => { const { rate } = itemMap.Pen; const quantity = 1; - const batchNumber = batchMap.batchTwo.name; + const batch = batchMap.batchTwo.name; const stockMovement = await getStockMovement( MovementType.MaterialTransfer, @@ -195,7 +195,7 @@ test('batched item, create stock movement, material transfer', async (t) => { item: itemMap.Pen.name, from: locationMap.LocationOne, to: locationMap.LocationTwo, - batchNumber, + batch, quantity, rate, }, @@ -210,7 +210,7 @@ test('batched item, create stock movement, material transfer', async (t) => { locationMap.LocationOne, undefined, undefined, - batchNumber + batch ), 0, 'location one batch transacted out' @@ -222,7 +222,7 @@ test('batched item, create stock movement, material transfer', async (t) => { locationMap.LocationTwo, undefined, undefined, - batchNumber + batch ), quantity, 'location two batch transacted in' @@ -251,7 +251,7 @@ test('batched item, create invalid stock movements', async (t) => { { item: itemMap.Pen.name, from: locationMap.LocationTwo, - batchNumber: batchMap.batchOne.name, + batch: batchMap.batchOne.name, quantity, rate, }, diff --git a/models/inventory/types.ts b/models/inventory/types.ts index c07bc3e4..eab8769c 100644 --- a/models/inventory/types.ts +++ b/models/inventory/types.ts @@ -22,7 +22,7 @@ export interface SMTransferDetails { item: string; rate: Money; quantity: number; - batchNumber?: string; + batch?: string; fromLocation?: string; toLocation?: string; } diff --git a/models/types.ts b/models/types.ts index 61cbaf02..d6c4d3c2 100644 --- a/models/types.ts +++ b/models/types.ts @@ -4,7 +4,7 @@ export enum ModelNameEnum { AccountingLedgerEntry = 'AccountingLedgerEntry', AccountingSettings = 'AccountingSettings', Address = 'Address', - BatchNumber= 'BatchNumber', + Batch= 'Batch', Color = 'Color', CompanySettings = 'CompanySettings', Currency = 'Currency', diff --git a/reports/inventory/StockBalance.ts b/reports/inventory/StockBalance.ts index 827bb057..cf6795e8 100644 --- a/reports/inventory/StockBalance.ts +++ b/reports/inventory/StockBalance.ts @@ -62,7 +62,7 @@ export class StockBalance extends StockLedger { ? [ { fieldtype: 'Link', - target: 'BatchNumber', + target: 'Batch', placeholder: t`Batch`, label: t`Batch`, fieldname: 'batch', diff --git a/reports/inventory/StockLedger.ts b/reports/inventory/StockLedger.ts index bed69661..2544d8d9 100644 --- a/reports/inventory/StockLedger.ts +++ b/reports/inventory/StockLedger.ts @@ -117,7 +117,7 @@ export class StockLedger extends Report { continue; } - if (this.batch && row.batchNumber !== this.batch) { + if (this.batch && row.batch !== this.batch) { continue; } @@ -359,7 +359,7 @@ export class StockLedger extends Report { ? ([ { fieldtype: 'Link', - target: 'BatchNumber', + target: 'Batch', placeholder: t`Batch`, label: t`Batch`, fieldname: 'batch', diff --git a/reports/inventory/helpers.ts b/reports/inventory/helpers.ts index e110a96f..921fa4f2 100644 --- a/reports/inventory/helpers.ts +++ b/reports/inventory/helpers.ts @@ -11,14 +11,14 @@ import { type Item = string; type Location = string; -type BatchNo = string; +type Batch = string; export async function getRawStockLedgerEntries(fyo: Fyo) { const fieldnames = [ 'name', 'date', 'item', - 'batchNumber', + 'batch', 'rate', 'quantity', 'location', @@ -40,7 +40,7 @@ export function getStockLedgerEntries( const computedSLEs: ComputedStockLedgerEntry[] = []; const stockQueues: Record< Item, - Record> + Record> > = {}; for (const sle of rawSLEs) { @@ -48,7 +48,7 @@ export function getStockLedgerEntries( const date = new Date(sle.date); const rate = safeParseFloat(sle.rate); const { item, location, quantity, referenceName, referenceType } = sle; - const batchNumber = sle.batchNumber ?? ''; + const batch = sle.batch ?? ''; if (quantity === 0) { continue; @@ -56,9 +56,9 @@ export function getStockLedgerEntries( stockQueues[item] ??= {}; stockQueues[item][location] ??= {}; - stockQueues[item][location][batchNumber] ??= new StockQueue(); + stockQueues[item][location][batch] ??= new StockQueue(); - const q = stockQueues[item][location][batchNumber]; + const q = stockQueues[item][location][batch]; const initialValue = q.value; let incomingRate: number | null; @@ -87,7 +87,7 @@ export function getStockLedgerEntries( item, location, - batchNumber, + batch, quantity, balanceQuantity, @@ -119,7 +119,7 @@ export function getStockBalanceEntries( ): StockBalanceEntry[] { const sbeMap: Record< Item, - Record> + Record> > = {}; const fromDate = filters.fromDate ? Date.parse(filters.fromDate) : null; @@ -134,19 +134,19 @@ export function getStockBalanceEntries( continue; } - const batchNumber = sle.batchNumber || ''; + const batch = sle.batch || ''; sbeMap[sle.item] ??= {}; sbeMap[sle.item][sle.location] ??= {}; - sbeMap[sle.item][sle.location][batchNumber] ??= getSBE( + sbeMap[sle.item][sle.location][batch] ??= getSBE( sle.item, sle.location, - batchNumber + batch ); const date = sle.date.valueOf(); if (fromDate && date < fromDate) { - const sbe = sbeMap[sle.item][sle.location][batchNumber]; + const sbe = sbeMap[sle.item][sle.location][batch]; updateOpeningBalances(sbe, sle); continue; } @@ -155,7 +155,7 @@ export function getStockBalanceEntries( continue; } - const sbe = sbeMap[sle.item][sle.location][batchNumber]; + const sbe = sbeMap[sle.item][sle.location][batch]; updateCurrentBalances(sbe, sle); } @@ -169,14 +169,14 @@ export function getStockBalanceEntries( function getSBE( item: string, location: string, - batchNumber: string + batch: string ): StockBalanceEntry { return { name: 0, item, location, - batchNumber, + batch, balanceQuantity: 0, balanceValue: 0, diff --git a/reports/inventory/types.ts b/reports/inventory/types.ts index 40531446..af877e81 100644 --- a/reports/inventory/types.ts +++ b/reports/inventory/types.ts @@ -5,7 +5,7 @@ export interface RawStockLedgerEntry { date: string; item: string; rate: string; - batchNumber: string | null; + batch: string | null; quantity: number; location: string; referenceName: string; @@ -20,7 +20,7 @@ export interface ComputedStockLedgerEntry{ item: string; location:string; - batchNumber: string; + batch: string; quantity: number; balanceQuantity: number; @@ -41,7 +41,7 @@ export interface StockBalanceEntry{ item: string; location:string; - batchNumber: string; + batch: string; balanceQuantity: number; balanceValue: number; diff --git a/schemas/app/BatchNumber.json b/schemas/app/Batch.json similarity index 85% rename from schemas/app/BatchNumber.json rename to schemas/app/Batch.json index 6596d02f..251c215f 100644 --- a/schemas/app/BatchNumber.json +++ b/schemas/app/Batch.json @@ -1,12 +1,12 @@ { - "name": "BatchNumber", - "label": "Batch Number", + "name": "Batch", + "label": "Batch", "naming": "manual", "fields": [ { "fieldname": "name", "fieldtype": "Data", - "label": "Batch Number", + "label": "Batch", "required": true }, { diff --git a/schemas/app/InvoiceItem.json b/schemas/app/InvoiceItem.json index b7d544c5..c4abaa69 100644 --- a/schemas/app/InvoiceItem.json +++ b/schemas/app/InvoiceItem.json @@ -48,12 +48,12 @@ "readOnly": true }, { - "fieldname": "batchNumber", - "label": "Batch No", + "fieldname": "batch", + "label": "Batch", "fieldtype": "Link", "create": true, - "target": "BatchNumber", - "placeholder": "Batch No" + "target": "Batch", + "placeholder": "Batch" }, { "fieldname": "quantity", @@ -146,7 +146,7 @@ "transferQuantity", "transferUnit", - "batchNumber", + "batch", "quantity", "unit", "unitConversionFactor", diff --git a/schemas/app/Item.json b/schemas/app/Item.json index bd9bf838..83141278 100644 --- a/schemas/app/Item.json +++ b/schemas/app/Item.json @@ -132,8 +132,8 @@ "default": false }, { - "fieldname": "hasBatchNumber", - "label": "Has Batch Number", + "fieldname": "hasBatch", + "label": "Has Batch", "fieldtype": "Check", "default": false, "section": "Inventory" diff --git a/schemas/app/PrintSettings.json b/schemas/app/PrintSettings.json index 25fa62df..08f8f16c 100644 --- a/schemas/app/PrintSettings.json +++ b/schemas/app/PrintSettings.json @@ -30,8 +30,8 @@ "fieldtype": "Check" }, { - "fieldname": "displayBatchNumber", - "label": "Display Batch Number", + "fieldname": "displayBatch", + "label": "Display Batch", "fieldtype": "Check" }, { @@ -143,7 +143,7 @@ "logo", "displayLogo", "displayTaxInvoice", - "displayBatchNumber", + "displayBatch", "template", "color", "font", diff --git a/schemas/app/inventory/StockLedgerEntry.json b/schemas/app/inventory/StockLedgerEntry.json index 9f6dbda7..aefe17cb 100644 --- a/schemas/app/inventory/StockLedgerEntry.json +++ b/schemas/app/inventory/StockLedgerEntry.json @@ -51,10 +51,10 @@ "readOnly": true }, { - "fieldname": "batchNumber", - "label": "Batch No", + "fieldname": "batch", + "label": "Batch", "fieldtype": "Link", - "target": "BatchNumber", + "target": "Batch", "readOnly": true } ] diff --git a/schemas/app/inventory/StockMovementItem.json b/schemas/app/inventory/StockMovementItem.json index e3f536cf..a7bf4457 100644 --- a/schemas/app/inventory/StockMovementItem.json +++ b/schemas/app/inventory/StockMovementItem.json @@ -51,10 +51,10 @@ "readOnly": true }, { - "fieldname": "batchNumber", - "label": "Batch No", + "fieldname": "batch", + "label": "Batch", "fieldtype": "Link", - "target": "BatchNumber", + "target": "Batch", "create": true }, { @@ -93,7 +93,7 @@ "transferQuantity", "transferUnit", - "batchNumber", + "batch", "quantity", "unit", "unitConversionFactor", diff --git a/schemas/app/inventory/StockTransferItem.json b/schemas/app/inventory/StockTransferItem.json index 3262a0b7..03590954 100644 --- a/schemas/app/inventory/StockTransferItem.json +++ b/schemas/app/inventory/StockTransferItem.json @@ -42,10 +42,10 @@ "readOnly": true }, { - "fieldname": "batchNumber", - "label": "Batch No", + "fieldname": "batch", + "label": "Batch", "fieldtype": "Link", - "target": "BatchNumber" + "target": "Batch" }, { "fieldname": "quantity", @@ -92,7 +92,7 @@ "transferQuantity", "transferUnit", - "batchNumber", + "batch", "quantity", "unit", "unitConversionFactor", diff --git a/schemas/schemas.ts b/schemas/schemas.ts index 25ca0c26..8d4fdf0f 100644 --- a/schemas/schemas.ts +++ b/schemas/schemas.ts @@ -47,7 +47,7 @@ import submittable from './meta/submittable.json'; import tree from './meta/tree.json'; import { Schema, SchemaStub } from './types'; import InventorySettings from './app/inventory/InventorySettings.json'; -import BatchNumber from './app/BatchNumber.json' +import Batch from './app/Batch.json' export const coreSchemas: Schema[] = [ PatchRun as Schema, @@ -116,5 +116,5 @@ export const appSchemas: Schema[] | SchemaStub[] = [ PurchaseReceipt as Schema, PurchaseReceiptItem as Schema, - BatchNumber as Schema + Batch as Schema ]; diff --git a/src/components/SalesInvoice/Templates/BaseTemplate.vue b/src/components/SalesInvoice/Templates/BaseTemplate.vue index 0d77e16f..e7b90e30 100644 --- a/src/components/SalesInvoice/Templates/BaseTemplate.vue +++ b/src/components/SalesInvoice/Templates/BaseTemplate.vue @@ -83,7 +83,7 @@ export default { showHSN: this.showHSN, displayLogo: this.printSettings.displayLogo, displayTaxInvoice: this.printSettings.displayTaxInvoice, - displayBatchNumber: this.printSettings.displayBatchNumber, + displayBatch: this.printSettings.displayBatch, discountAfterTax: this.doc.discountAfterTax, logo: this.printSettings.logo, companyName: this.fyo.singles.AccountingSettings.companyName, diff --git a/src/components/SalesInvoice/Templates/Basic.vue b/src/components/SalesInvoice/Templates/Basic.vue index d83520b3..04fc85fe 100644 --- a/src/components/SalesInvoice/Templates/Basic.vue +++ b/src/components/SalesInvoice/Templates/Basic.vue @@ -74,9 +74,9 @@
Quantity
- Batch No + Batch
Rate
Amount
@@ -93,9 +93,9 @@
{{ row.quantity }}
- {{ row.batchNumber }} + {{ row.batch }}
{{ row.rate }}
{{ row.amount }}
diff --git a/src/components/SalesInvoice/Templates/Business.vue b/src/components/SalesInvoice/Templates/Business.vue index 93162eee..b75c7e36 100644 --- a/src/components/SalesInvoice/Templates/Business.vue +++ b/src/components/SalesInvoice/Templates/Business.vue @@ -68,8 +68,8 @@
Item
HSN/SAC
Quantity
-
- Batch No +
+ Batch
Rate
Amount
@@ -84,8 +84,8 @@ {{ row.hsnCode }}
{{ row.quantity }}
-
- {{ row.batchNumber }} +
+ {{ row.batch }}
{{ row.rate }}
{{ row.amount }}
diff --git a/src/components/SalesInvoice/Templates/Minimal.vue b/src/components/SalesInvoice/Templates/Minimal.vue index 30e38cc3..9d2ec8e8 100644 --- a/src/components/SalesInvoice/Templates/Minimal.vue +++ b/src/components/SalesInvoice/Templates/Minimal.vue @@ -112,8 +112,8 @@
Item
HSN/SAC
Quantity
-
- Batch No +
+ Batch
Rate
Amount
@@ -128,8 +128,8 @@ {{ row.hsnCode }}
{{ row.quantity }}
-
- {{ row.batchNumber }} +
+ {{ row.batch }}
{{ row.rate }}
{{ row.amount }}
diff --git a/src/utils/search.ts b/src/utils/search.ts index cfa581d7..ddbcfb19 100644 --- a/src/utils/search.ts +++ b/src/utils/search.ts @@ -236,7 +236,7 @@ function getListViewList(fyo: Fyo): SearchItem[] { const hasBatch = fyo.doc.singles.InventorySettings?.enableBatches; if (hasBatch) { - schemaNames.push(ModelNameEnum.BatchNumber); + schemaNames.push(ModelNameEnum.Batch); } if (fyo.store.isDevelopment) {