2
0
mirror of https://github.com/frappe/books.git synced 2025-01-23 15:18:24 +00:00

feat: models for erpnext sync

This commit is contained in:
akshayitzme 2024-10-24 09:51:28 +05:30
parent dae9ed2244
commit 3d94b4b8ea
3 changed files with 67 additions and 1 deletions

View File

@ -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;
},
};
}

View File

@ -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(

View File

@ -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;