diff --git a/models/baseModels/ERPNextSyncSettings/ERPNextSyncSettings.ts b/models/baseModels/ERPNextSyncSettings/ERPNextSyncSettings.ts new file mode 100644 index 00000000..63d21b25 --- /dev/null +++ b/models/baseModels/ERPNextSyncSettings/ERPNextSyncSettings.ts @@ -0,0 +1,61 @@ +import { Doc } from 'fyo/model/doc'; +import { HiddenMap } from 'fyo/model/types'; + +export class ERPNextSyncSettings extends Doc { + endpoint?: string; + authToken?: string; + integrationAppVersion?: string; + isEnabled?: boolean; + dataSyncInterval?: number; + + syncItem?: boolean; + itemSyncType?: string; + + syncCustomer?: boolean; + customerSyncType?: string; + + syncSupplier?: boolean; + supplierSyncType?: string; + + syncSalesInvoice?: boolean; + salesInvoiceSyncType?: string; + + syncSalesInvoicePayment?: boolean; + sinvPaymentType?: string; + + syncStockMovement?: boolean; + stockMovementSyncType?: string; + + syncPriceList?: boolean; + priceListSyncType?: string; + + syncSerialNumber?: boolean; + serialNumberSyncType?: string; + + syncBatch?: boolean; + batchSyncType?: string; + + syncShipment?: boolean; + shipmentSyncType?: string; + + hidden: HiddenMap = { + syncPriceList: () => { + return !this.fyo.singles.AccountingSettings?.enablePriceList; + }, + priceListSyncType: () => { + return !this.fyo.singles.AccountingSettings?.enablePriceList; + }, + syncSerialNumber: () => { + return !this.fyo.singles.InventorySettings?.enableSerialNumber; + }, + serialNumberSyncType: () => { + return !this.fyo.singles.InventorySettings?.enableSerialNumber; + }, + syncBatch: () => { + return !this.fyo.singles.InventorySettings?.enableBatches; + }, + batchSyncType: () => { + return !this.fyo.singles.InventorySettings?.enableBatches; + }, + }; +} diff --git a/models/index.ts b/models/index.ts index ed4973b3..05d073ea 100644 --- a/models/index.ts +++ b/models/index.ts @@ -49,6 +49,7 @@ import { OpeningAmounts } from './inventory/Point of Sale/OpeningAmounts'; import { OpeningCash } from './inventory/Point of Sale/OpeningCash'; import { POSSettings } from './inventory/Point of Sale/POSSettings'; import { POSShift } from './inventory/Point of Sale/POSShift'; +import { ERPNextSyncSettings } from './baseModels/ERPNextSyncSettings/ERPNextSyncSettings'; export const models = { Account, @@ -103,6 +104,8 @@ export const models = { OpeningCash, POSSettings, POSShift, + // ERPNext Sync + ERPNextSyncSettings, } as ModelMap; export async function getRegionalModels( diff --git a/models/types.ts b/models/types.ts index 2420b8fe..ff70c075 100644 --- a/models/types.ts +++ b/models/types.ts @@ -59,7 +59,9 @@ export enum ModelNameEnum { CustomForm = 'CustomForm', CustomField = 'CustomField', POSSettings = 'POSSettings', - POSShift = 'POSShift' + POSShift = 'POSShift', + + ERPNextSyncSettings= 'ERPNextSyncSettings' } export type ModelName = keyof typeof ModelNameEnum;