diff --git a/fyo/model/types.ts b/fyo/model/types.ts index d5d51fca..cb1b08bd 100644 --- a/fyo/model/types.ts +++ b/fyo/model/types.ts @@ -2,7 +2,7 @@ import { DocValue, DocValueMap } from 'fyo/core/types'; import SystemSettings from 'fyo/models/SystemSettings'; import { FieldType, Schema, SelectOption } from 'schemas/types'; import { QueryFilter } from 'utils/db/types'; -import { Router } from 'vue-router'; +import { RouteLocationRaw, Router } from 'vue-router'; import { Doc } from './doc'; /** @@ -87,7 +87,7 @@ export interface ColumnConfig { export type ListViewColumn = string | ColumnConfig; export interface ListViewSettings { - formRoute?: (name: string) => string; + formRoute?: (doc: Doc) => RouteLocationRaw; columns?: ListViewColumn[]; } diff --git a/models/baseModels/Item/Item.ts b/models/baseModels/Item/Item.ts index b3339570..0eac8acd 100644 --- a/models/baseModels/Item/Item.ts +++ b/models/baseModels/Item/Item.ts @@ -17,6 +17,7 @@ import { AccountRootTypeEnum, AccountTypeEnum } from '../Account/types'; export class Item extends Doc { trackItem?: boolean; itemType?: 'Product' | 'Service'; + for?: 'Purchases' | 'Sales' | 'Both'; formulas: FormulaMap = { incomeAccount: { diff --git a/models/baseModels/JournalEntry/JournalEntry.ts b/models/baseModels/JournalEntry/JournalEntry.ts index 2d357857..dced2554 100644 --- a/models/baseModels/JournalEntry/JournalEntry.ts +++ b/models/baseModels/JournalEntry/JournalEntry.ts @@ -4,14 +4,15 @@ import { Action, DefaultMap, FiltersMap, - ListViewSettings + ListViewSettings, } from 'fyo/model/types'; import { DateTime } from 'luxon'; import { getDocStatus, getLedgerLinkAction, - getNumberSeries, getStatusText, - statusColor + getNumberSeries, + getStatusText, + statusColor, } from 'models/helpers'; import { Transactional } from 'models/Transactional/Transactional'; import { Money } from 'pesa'; @@ -53,7 +54,7 @@ export class JournalEntry extends Transactional { static getListViewSettings(): ListViewSettings { return { - formRoute: (name) => `/edit/JournalEntry/${name}`, + formRoute: ({ name }) => `/edit/JournalEntry/${name}`, columns: [ 'name', { diff --git a/models/baseModels/PurchaseInvoice/PurchaseInvoice.ts b/models/baseModels/PurchaseInvoice/PurchaseInvoice.ts index a8a7f8b0..5a7e64fd 100644 --- a/models/baseModels/PurchaseInvoice/PurchaseInvoice.ts +++ b/models/baseModels/PurchaseInvoice/PurchaseInvoice.ts @@ -37,7 +37,7 @@ export class PurchaseInvoice extends Invoice { static getListViewSettings(): ListViewSettings { return { - formRoute: (name) => `/edit/PurchaseInvoice/${name}`, + formRoute: ({ name }) => `/edit/PurchaseInvoice/${name}`, columns: [ 'name', getTransactionStatusColumn(), diff --git a/models/baseModels/SalesInvoice/SalesInvoice.ts b/models/baseModels/SalesInvoice/SalesInvoice.ts index 5064887f..525faaf7 100644 --- a/models/baseModels/SalesInvoice/SalesInvoice.ts +++ b/models/baseModels/SalesInvoice/SalesInvoice.ts @@ -37,7 +37,7 @@ export class SalesInvoice extends Invoice { static getListViewSettings(): ListViewSettings { return { - formRoute: (name) => `/edit/SalesInvoice/${name}`, + formRoute: ({ name }) => `/edit/SalesInvoice/${name}`, columns: [ 'name', getTransactionStatusColumn(), diff --git a/models/inventory/PurchaseReceipt.ts b/models/inventory/PurchaseReceipt.ts index 490e2af5..019c75b4 100644 --- a/models/inventory/PurchaseReceipt.ts +++ b/models/inventory/PurchaseReceipt.ts @@ -8,7 +8,7 @@ export class PurchaseReceipt extends StockTransfer { static getListViewSettings(): ListViewSettings { return { - formRoute: (name) => `/edit/PurchaseReceipt/${name}`, + formRoute: ({ name }) => `/edit/PurchaseReceipt/${name}`, columns: [ 'name', getTransactionStatusColumn(), diff --git a/models/inventory/Shipment.ts b/models/inventory/Shipment.ts index 8411601c..20d7baaa 100644 --- a/models/inventory/Shipment.ts +++ b/models/inventory/Shipment.ts @@ -8,7 +8,7 @@ export class Shipment extends StockTransfer { static getListViewSettings(): ListViewSettings { return { - formRoute: (name) => `/edit/Shipment/${name}`, + formRoute: ({ name }) => `/edit/Shipment/${name}`, columns: [ 'name', getTransactionStatusColumn(), diff --git a/src/components/Widgets/LinkedEntryWidget.vue b/src/components/Widgets/LinkedEntryWidget.vue index f4a535d1..ec3b113c 100644 --- a/src/components/Widgets/LinkedEntryWidget.vue +++ b/src/components/Widgets/LinkedEntryWidget.vue @@ -55,7 +55,7 @@