From ccc14814feb104a5208ff16239193220b6e5a48e Mon Sep 17 00:00:00 2001 From: akshayitzme Date: Tue, 26 Nov 2024 12:40:28 +0530 Subject: [PATCH] incr: fix types --- fyo/model/doc.ts | 2 +- src/utils/erpnextSync.ts | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/fyo/model/doc.ts b/fyo/model/doc.ts index 7d8990732..fe0414475 100644 --- a/fyo/model/doc.ts +++ b/fyo/model/doc.ts @@ -249,7 +249,7 @@ export class Doc extends Observable { return true; } - get shouldDocSyncToERPNext() { + get shouldDocSyncToERPNext(): boolean { const syncEnabled = !!this.fyo.singles.ERPNextSyncSettings?.isEnabled; if (!syncEnabled) { return false; diff --git a/src/utils/erpnextSync.ts b/src/utils/erpnextSync.ts index 0d72eb7dd..baf13c6a7 100644 --- a/src/utils/erpnextSync.ts +++ b/src/utils/erpnextSync.ts @@ -52,7 +52,8 @@ export function initERPNSync(fyo: Fyo) { return; } - const syncInterval = fyo.singles.ERPNextSyncSettings?.dataSyncInterval; + const syncInterval = fyo.singles.ERPNextSyncSettings + ?.dataSyncInterval as number; if (!syncInterval) { return; @@ -72,8 +73,8 @@ export async function syncDocumentsFromERPNext(fyo: Fyo) { return; } - const token = fyo.singles.ERPNextSyncSettings?.authToken; - const endpoint = fyo.singles.ERPNextSyncSettings?.endpoint; + const token = fyo.singles.ERPNextSyncSettings?.authToken as string; + const endpoint = fyo.singles.ERPNextSyncSettings?.endpoint as string; if (!token || !endpoint) { return; @@ -104,7 +105,7 @@ export async function syncDocumentsFromERPNext(fyo: Fyo) { ); await existingDoc.setMultiple(doc); - await performPreSync(fyo, doc, existingDoc); + await performPreSync(fyo, doc); existingDoc._addDocToSyncQueue = false; await existingDoc.sync(); @@ -125,7 +126,7 @@ export async function syncDocumentsFromERPNext(fyo: Fyo) { try { const newDoc = fyo.doc.getNewDoc(getDocTypeName(doc), doc); - await performPreSync(fyo, doc, newDoc); + await performPreSync(fyo, doc); newDoc._addDocToSyncQueue = false; await newDoc.sync(); @@ -497,7 +498,7 @@ export function getShouldDocSyncToERPNext( syncSettings.supplierSyncType !== 'ERPNext to FBooks' ); - case ModelNameEnum.PriceListItem: + case 'PriceListItem': const isPriceListSyncEnabled = !!syncSettings.syncPriceList; return (