mirror of
https://github.com/frappe/books.git
synced 2026-08-24 10:04:45 -05:00
feat: batch transactions
This commit is contained in:
@@ -18,6 +18,8 @@ export class Item extends Doc {
|
||||
trackItem?: boolean;
|
||||
itemType?: 'Product' | 'Service';
|
||||
for?: 'Purchases' | 'Sales' | 'Both';
|
||||
hasBatchNumber?: boolean;
|
||||
batchNumber?:string;
|
||||
|
||||
formulas: FormulaMap = {
|
||||
incomeAccount: {
|
||||
|
||||
@@ -11,6 +11,7 @@ export class PurchaseReceipt extends StockTransfer {
|
||||
formRoute: ({ name }) => `/edit/PurchaseReceipt/${name}`,
|
||||
columns: [
|
||||
'name',
|
||||
'batchNumber',
|
||||
getTransactionStatusColumn(),
|
||||
'party',
|
||||
'date',
|
||||
|
||||
@@ -10,4 +10,5 @@ export class StockLedgerEntry extends Doc {
|
||||
location?: string;
|
||||
referenceName?: string;
|
||||
referenceType?: string;
|
||||
batchNumber?: string;
|
||||
}
|
||||
|
||||
@@ -204,6 +204,7 @@ class StockManagerItem {
|
||||
referenceType: string;
|
||||
fromLocation?: string;
|
||||
toLocation?: string;
|
||||
batchNumber?: string;
|
||||
|
||||
stockLedgerEntries?: StockLedgerEntry[];
|
||||
|
||||
@@ -218,6 +219,7 @@ class StockManagerItem {
|
||||
this.toLocation = details.toLocation;
|
||||
this.referenceName = details.referenceName;
|
||||
this.referenceType = details.referenceType;
|
||||
this.batchNumber = details.batchNumber;
|
||||
|
||||
this.fyo = fyo;
|
||||
}
|
||||
@@ -270,6 +272,7 @@ class StockManagerItem {
|
||||
date: this.date,
|
||||
item: this.item,
|
||||
rate: this.rate,
|
||||
batchNumber: this.batchNumber,
|
||||
quantity,
|
||||
location,
|
||||
referenceName: this.referenceName,
|
||||
|
||||
@@ -84,6 +84,7 @@ export class StockMovement extends Transfer {
|
||||
item: row.item!,
|
||||
rate: row.rate!,
|
||||
quantity: row.quantity!,
|
||||
batchNumber: row.batchNumber!,
|
||||
fromLocation: row.fromLocation,
|
||||
toLocation: row.toLocation,
|
||||
}));
|
||||
|
||||
@@ -19,6 +19,7 @@ export class StockMovementItem extends Doc {
|
||||
rate?: Money;
|
||||
amount?: Money;
|
||||
parentdoc?: StockMovement;
|
||||
batchNumber? : string;
|
||||
|
||||
get isIssue() {
|
||||
return this.parentdoc?.movementType === MovementType.MaterialIssue;
|
||||
|
||||
@@ -68,6 +68,7 @@ export abstract class StockTransfer extends Transfer {
|
||||
item: row.item!,
|
||||
rate: row.rate!,
|
||||
quantity: row.quantity!,
|
||||
batchNumber: row.batchNumber!,
|
||||
fromLocation,
|
||||
toLocation,
|
||||
};
|
||||
|
||||
@@ -12,6 +12,7 @@ export class StockTransferItem extends Doc {
|
||||
unit?: string;
|
||||
description?: string;
|
||||
hsnCode?: number;
|
||||
batchNumber?: string
|
||||
|
||||
formulas: FormulaMap = {
|
||||
description: {
|
||||
|
||||
@@ -21,6 +21,7 @@ export interface SMTransferDetails {
|
||||
item: string;
|
||||
rate: Money;
|
||||
quantity: number;
|
||||
batchNumber?: string;
|
||||
fromLocation?: string;
|
||||
toLocation?: string;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ export async function getRawStockLedgerEntries(fyo: Fyo) {
|
||||
'name',
|
||||
'date',
|
||||
'item',
|
||||
"batchNumber",
|
||||
'rate',
|
||||
'quantity',
|
||||
'location',
|
||||
@@ -42,7 +43,7 @@ export function getStockLedgerEntries(
|
||||
const name = safeParseInt(sle.name);
|
||||
const date = new Date(sle.date);
|
||||
const rate = safeParseFloat(sle.rate);
|
||||
const { item, location, quantity, referenceName, referenceType } = sle;
|
||||
const { item, location, batchNumber, quantity, referenceName, referenceType } = sle;
|
||||
|
||||
if (quantity === 0) {
|
||||
continue;
|
||||
@@ -81,6 +82,7 @@ export function getStockLedgerEntries(
|
||||
item,
|
||||
location,
|
||||
|
||||
batchNumber,
|
||||
quantity,
|
||||
balanceQuantity,
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ export interface RawStockLedgerEntry {
|
||||
date: string;
|
||||
item: string;
|
||||
rate: string;
|
||||
batchNumber: string;
|
||||
quantity: number;
|
||||
location: string;
|
||||
referenceName: string;
|
||||
@@ -20,6 +21,7 @@ export interface ComputedStockLedgerEntry{
|
||||
item: string;
|
||||
location:string;
|
||||
|
||||
batchNumber: string;
|
||||
quantity: number;
|
||||
balanceQuantity: number;
|
||||
|
||||
|
||||
@@ -93,9 +93,16 @@
|
||||
"label": "Stock Not Transferred",
|
||||
"fieldtype": "Float",
|
||||
"readOnly": true
|
||||
},
|
||||
{
|
||||
"fieldname": "batchNumber",
|
||||
"label": "Batch No",
|
||||
"fieldtype": "Data",
|
||||
"create": true,
|
||||
"placeholder": "Batch No"
|
||||
}
|
||||
],
|
||||
"tableFields": ["item", "tax", "quantity", "rate", "amount"],
|
||||
"tableFields": ["item", "tax", "quantity", "rate", "amount", "batchNumber"],
|
||||
"keywordFields": ["item", "tax"],
|
||||
"quickEditFields": [
|
||||
"item",
|
||||
@@ -110,6 +117,7 @@
|
||||
"itemDiscountAmount",
|
||||
"itemDiscountPercent",
|
||||
"itemDiscountedTotal",
|
||||
"itemTaxedTotal"
|
||||
"itemTaxedTotal",
|
||||
"batchNumber"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -31,6 +31,12 @@
|
||||
"default": "Unit",
|
||||
"placeholder": "Unit Type"
|
||||
},
|
||||
{
|
||||
"fieldname": "hasBatchNumber",
|
||||
"label": "Has Batch No",
|
||||
"fieldtype": "Check",
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"fieldname": "itemType",
|
||||
"label": "Type",
|
||||
@@ -116,6 +122,7 @@
|
||||
"quickEditFields": [
|
||||
"rate",
|
||||
"unit",
|
||||
"hasBatchNumber",
|
||||
"itemType",
|
||||
"for",
|
||||
"tax",
|
||||
|
||||
@@ -49,6 +49,13 @@
|
||||
"label": "Ref. Type",
|
||||
"fieldtype": "Data",
|
||||
"readOnly": true
|
||||
},
|
||||
{
|
||||
"fieldname": "batchNumber",
|
||||
"label": "Batch No",
|
||||
"fieldtype": "Data",
|
||||
"create": true,
|
||||
"placeholder": "Batch No"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
"target": "Location",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"fieldname": "batchNumber",
|
||||
"label": "Batch No",
|
||||
"fieldtype": "Data"
|
||||
},
|
||||
{
|
||||
"fieldname": "quantity",
|
||||
"label": "Quantity",
|
||||
|
||||
Reference in New Issue
Block a user