2
0
mirror of https://github.com/frappe/books.git synced 2025-01-03 07:12:21 +00:00

feat: add uom conversion

This commit is contained in:
18alantom 2023-02-21 13:33:30 +05:30
parent 14f832dabf
commit 60189d527b
6 changed files with 52 additions and 1 deletions

View File

@ -26,6 +26,7 @@ import { ShipmentItem } from './inventory/ShipmentItem';
import { StockLedgerEntry } from './inventory/StockLedgerEntry';
import { StockMovement } from './inventory/StockMovement';
import { StockMovementItem } from './inventory/StockMovementItem';
import { UOMConversion } from './inventory/UOMConversion';
export const models = {
Account,
@ -48,6 +49,7 @@ export const models = {
TaxSummary,
// Inventory Models
InventorySettings,
UOMConversion,
StockMovement,
StockMovementItem,
StockLedgerEntry,

View File

@ -0,0 +1,14 @@
import { Doc } from 'fyo/model/doc';
import { ListViewSettings } from 'fyo/model/types';
export class UOMConversion extends Doc {
toUOM?: string;
fromUOM?: string;
conversionFactor?: number;
static getListViewSettings(): ListViewSettings {
return {
columns: ['fromUOM', 'toUOM', 'conversionFactor'],
};
}
}

View File

@ -39,6 +39,7 @@ export enum ModelNameEnum {
PurchaseReceipt = 'PurchaseReceipt',
PurchaseReceiptItem = 'PurchaseReceiptItem',
Location = 'Location',
UOMConversion = 'UOMConversion'
}
export type ModelName = keyof typeof ModelNameEnum;

View File

@ -0,0 +1,31 @@
{
"name": "UOMConversion",
"label": "UOM Conversion",
"naming": "autoincrement",
"fields": [
{
"fieldname": "fromUOM",
"label": "From UOM",
"fieldtype": "Link",
"target": "UOM",
"create": true,
"required": true
},
{
"fieldname": "toUOM",
"label": "To UOM",
"fieldtype": "Link",
"target": "UOM",
"create": true,
"required": true
},
{
"fieldname": "conversionFactor",
"label": "Conversion Factor",
"fieldtype": "Float",
"default": 1,
"required": true
}
],
"quickEditFields": ["fromUOM", "toUOM", "conversionFactor"]
}

View File

@ -46,6 +46,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 UOMConversion from './app/inventory/UOMConversion.json';
export const coreSchemas: Schema[] = [
PatchRun as Schema,
@ -105,6 +106,7 @@ export const appSchemas: Schema[] | SchemaStub[] = [
StockLedgerEntry as Schema,
StockMovement as Schema,
StockMovementItem as Schema,
UOMConversion as Schema,
StockTransfer as Schema,
StockTransferItem as Schema,

View File

@ -230,7 +230,8 @@ function getListViewList(fyo: Fyo): SearchItem[] {
schemaNames.push(
ModelNameEnum.StockMovement,
ModelNameEnum.Shipment,
ModelNameEnum.PurchaseReceipt
ModelNameEnum.PurchaseReceipt,
ModelNameEnum.UOMConversion
);
}