fix:formatted code

This commit is contained in:
Gadha2311
2026-01-31 18:50:27 +05:30
parent 08cbb4569c
commit 37972fa55b
6 changed files with 13 additions and 34 deletions
+11 -20
View File
@@ -46,6 +46,7 @@ import {
import { validateOptions, validateRequired } from './validationFunction';
import { getShouldDocSyncToERPNext } from 'src/utils/erpnextSync';
import { ModelNameEnum } from 'models/types';
import { DocItem } from 'models/inventory/types';
export class Doc extends Observable<DocValue | Doc[]> {
/* eslint-disable @typescript-eslint/no-floating-promises */
@@ -925,29 +926,19 @@ export class Doc extends Observable<DocValue | Doc[]> {
if (!isSalesInvoice) {
return true;
}
const items = (this.get('items') as Doc[]) ?? [];
for (const item of items) {
const itemName = item.get('item') as string;
if (!itemName) {
continue;
}
try {
const itemDoc = await this.fyo.doc.getDoc('Item', itemName);
const isInventoryItem = !!itemDoc.get('trackItem');
const isFromERP = !!itemDoc.get('datafromErp');
if (!isInventoryItem && isFromERP) {
return true;
}
} catch (err) {
for (const item of this.items as DocItem[]) {
if (!item.item) {
continue;
}
const isFromERP = await this.fyo.getValue(
ModelNameEnum.Item,
item.item,
'datafromErp'
);
if (isFromERP) continue;
else return false;
}
return false;
return true;
}
async sync(): Promise<Doc> {
@@ -40,9 +40,6 @@ export class ERPNextSyncSettings extends Doc {
batchSyncType: () => {
return !this.fyo.singles.InventorySettings?.enableBatches;
},
// syncDataFromServer: () => {
// return !this.deviceID;
// },
};
async change(ch: ChangeArg) {
-1
View File
@@ -119,7 +119,6 @@ export async function getItemVisibility(fyo: Fyo): Promise<ItemVisibility> {
const enableERPNextSync = fyo.singles.AccountingSettings?.enableERPNextSync;
if (enableERPNextSync) {
// When ERP sync is enabled, use itemVisibilityERP from POSSettings
return fyo.singles.POSSettings?.itemVisibilityERP as ItemVisibility;
}
@@ -47,6 +47,7 @@ export class POSSettings extends Doc {
!this.fyo.singles.InventorySettings?.enableBarcodes ||
!this.weightEnabledBarcode,
itemVisibility: () =>
!this.fyo.singles.AccountingSettings?.enablePointOfSaleWithOutInventory ||
!!this.fyo.singles.AccountingSettings?.enableERPNextSync,
itemVisibilityERP: () =>
!this.fyo.singles.AccountingSettings?.enableERPNextSync,
+1 -1
View File
@@ -176,7 +176,7 @@
{
"fieldname": "datafromErp",
"fieldtype": "Check",
"hidden": false,
"hidden": true,
"default": false,
"section": "Default"
}
@@ -96,13 +96,6 @@
"default": 0,
"section": "Barcode"
},
{
"fieldname": "itemWeightDigits",
"label": "item Weight Digits",
"fieldtype": "Int",
"default": 0,
"section": "Barcode"
},
{
"fieldname": "itemVisibility",
"label": "Item Visibility",
@@ -118,7 +111,6 @@
}
],
"default": "Inventory Items",
"required": true,
"section": "Default"
},
{
@@ -140,7 +132,6 @@
}
],
"default": "ERP Sync Items",
"required": true,
"section": "Default"
},
{