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:
parent
14f832dabf
commit
60189d527b
@ -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,
|
||||
|
14
models/inventory/UOMConversion.ts
Normal file
14
models/inventory/UOMConversion.ts
Normal 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'],
|
||||
};
|
||||
}
|
||||
}
|
@ -39,6 +39,7 @@ export enum ModelNameEnum {
|
||||
PurchaseReceipt = 'PurchaseReceipt',
|
||||
PurchaseReceiptItem = 'PurchaseReceiptItem',
|
||||
Location = 'Location',
|
||||
UOMConversion = 'UOMConversion'
|
||||
}
|
||||
|
||||
export type ModelName = keyof typeof ModelNameEnum;
|
||||
|
31
schemas/app/inventory/UOMConversion.json
Normal file
31
schemas/app/inventory/UOMConversion.json
Normal 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"]
|
||||
}
|
@ -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,
|
||||
|
@ -230,7 +230,8 @@ function getListViewList(fyo: Fyo): SearchItem[] {
|
||||
schemaNames.push(
|
||||
ModelNameEnum.StockMovement,
|
||||
ModelNameEnum.Shipment,
|
||||
ModelNameEnum.PurchaseReceipt
|
||||
ModelNameEnum.PurchaseReceipt,
|
||||
ModelNameEnum.UOMConversion
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user