2
0
mirror of https://github.com/frappe/books.git synced 2024-11-09 15:20:56 +00:00

refactor: rename Batch Number to Batch

This commit is contained in:
18alantom 2023-02-28 11:31:04 +05:30
parent 71aabec935
commit 487f0498a8
35 changed files with 133 additions and 137 deletions

View File

@ -138,7 +138,7 @@ export class BespokeQueries {
location?: string,
fromDate?: string,
toDate?: string,
batchNumber?: string
batch?: string
): Promise<number | null> {
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) {

View File

@ -313,7 +313,7 @@ export class DatabaseHandler extends DatabaseBase {
location?: string,
fromDate?: string,
toDate?: string,
batchNumber?: string
batch?: string
): Promise<number | null> {
return (await this.#demux.callBespoke(
'getStockQuantity',
@ -321,7 +321,7 @@ export class DatabaseHandler extends DatabaseBase {
location,
fromDate,
toDate,
batchNumber
batch
)) as number | null;
}

View File

@ -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,
});
}

View File

@ -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: () =>

View File

@ -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,
};
}

View File

@ -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,

View File

@ -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"],

View File

@ -10,5 +10,5 @@ export class StockLedgerEntry extends Doc {
location?: string;
referenceName?: string;
referenceType?: string;
batchNumber?: string;
batch?: string;
}

View File

@ -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,

View File

@ -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,
}));

View File

@ -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: () =>

View File

@ -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<void> {
await super.validate();
await validateBatchNumber(this);
await validateBatch(this);
}
static getActions(fyo: Fyo): Action[] {

View File

@ -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: () =>

View File

@ -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(' ')
);

View File

@ -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<Transfer, 'from' | 'to'> {
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<BatchNumber> {
): Promise<Batch> {
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,
});

View File

@ -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,
},

View File

@ -22,7 +22,7 @@ export interface SMTransferDetails {
item: string;
rate: Money;
quantity: number;
batchNumber?: string;
batch?: string;
fromLocation?: string;
toLocation?: string;
}

View File

@ -4,7 +4,7 @@ export enum ModelNameEnum {
AccountingLedgerEntry = 'AccountingLedgerEntry',
AccountingSettings = 'AccountingSettings',
Address = 'Address',
BatchNumber= 'BatchNumber',
Batch= 'Batch',
Color = 'Color',
CompanySettings = 'CompanySettings',
Currency = 'Currency',

View File

@ -62,7 +62,7 @@ export class StockBalance extends StockLedger {
? [
{
fieldtype: 'Link',
target: 'BatchNumber',
target: 'Batch',
placeholder: t`Batch`,
label: t`Batch`,
fieldname: 'batch',

View File

@ -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',

View File

@ -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<Location, Record<BatchNo, StockQueue>>
Record<Location, Record<Batch, StockQueue>>
> = {};
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<Location, Record<BatchNo, StockBalanceEntry>>
Record<Location, Record<Batch, StockBalanceEntry>>
> = {};
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,

View File

@ -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;

View File

@ -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
},
{

View File

@ -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",

View File

@ -132,8 +132,8 @@
"default": false
},
{
"fieldname": "hasBatchNumber",
"label": "Has Batch Number",
"fieldname": "hasBatch",
"label": "Has Batch",
"fieldtype": "Check",
"default": false,
"section": "Inventory"

View File

@ -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",

View File

@ -51,10 +51,10 @@
"readOnly": true
},
{
"fieldname": "batchNumber",
"label": "Batch No",
"fieldname": "batch",
"label": "Batch",
"fieldtype": "Link",
"target": "BatchNumber",
"target": "Batch",
"readOnly": true
}
]

View File

@ -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",

View File

@ -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",

View File

@ -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
];

View File

@ -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,

View File

@ -74,9 +74,9 @@
<div class="py-4 text-end w-2/12">Quantity</div>
<div
class="w-3/12 text-end py-4"
v-if="printObject.displayBatchNumber"
v-if="printObject.displayBatch"
>
Batch No
Batch
</div>
<div class="py-4 text-end w-3/12">Rate</div>
<div class="py-4 text-end w-3/12">Amount</div>
@ -93,9 +93,9 @@
<div class="w-2/12 text-end py-4">{{ row.quantity }}</div>
<div
class="w-3/12 text-end py-4"
v-if="printObject.displayBatchNumber"
v-if="printObject.displayBatch"
>
{{ row.batchNumber }}
{{ row.batch }}
</div>
<div class="w-3/12 text-end py-4">{{ row.rate }}</div>
<div class="w-3/12 text-end py-4">{{ row.amount }}</div>

View File

@ -68,8 +68,8 @@
<div class="w-4/12">Item</div>
<div class="w-2/12 text-end" v-if="printObject.showHSN">HSN/SAC</div>
<div class="w-2/12 text-end">Quantity</div>
<div class="w-3/12 text-end" v-if="printObject.displayBatchNumber">
Batch No
<div class="w-3/12 text-end" v-if="printObject.displayBatch">
Batch
</div>
<div class="w-3/12 text-end">Rate</div>
<div class="w-3/12 text-end">Amount</div>
@ -84,8 +84,8 @@
{{ row.hsnCode }}
</div>
<div class="w-2/12 text-end">{{ row.quantity }}</div>
<div class="w-3/12 text-end" v-if="printObject.displayBatchNumber">
{{ row.batchNumber }}
<div class="w-3/12 text-end" v-if="printObject.displayBatch">
{{ row.batch }}
</div>
<div class="w-3/12 text-end">{{ row.rate }}</div>
<div class="w-3/12 text-end">{{ row.amount }}</div>

View File

@ -112,8 +112,8 @@
<div class="w-4/12">Item</div>
<div class="w-2/12 text-end" v-if="printObject.showHSN">HSN/SAC</div>
<div class="w-2/12 text-end">Quantity</div>
<div class="w-3/12 text-end" v-if="printObject.displayBatchNumber">
Batch No
<div class="w-3/12 text-end" v-if="printObject.displayBatch">
Batch
</div>
<div class="w-3/12 text-end">Rate</div>
<div class="w-3/12 text-end">Amount</div>
@ -128,8 +128,8 @@
{{ row.hsnCode }}
</div>
<div class="w-2/12 text-end">{{ row.quantity }}</div>
<div class="w-3/12 text-end" v-if="printObject.displayBatchNumber">
{{ row.batchNumber }}
<div class="w-3/12 text-end" v-if="printObject.displayBatch">
{{ row.batch }}
</div>
<div class="w-3/12 text-end">{{ row.rate }}</div>
<div class="w-3/12 text-end">{{ row.amount }}</div>

View File

@ -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) {