From cd45653c911129bc0f9263a70fd24816ef13bb6a Mon Sep 17 00:00:00 2001 From: AbleKSaju <126228406+AbleKSaju@users.noreply.github.com> Date: Thu, 2 Jan 2025 12:02:16 +0530 Subject: [PATCH] fix: renamed filename & label from itemWeight to itemWeightDigits --- models/inventory/Point of Sale/POSSettings.ts | 8 ++++---- schemas/app/inventory/Point of Sale/POSSettings.json | 8 ++++---- src/components/Controls/weightEnabledBarcode.vue | 11 ++++++----- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/models/inventory/Point of Sale/POSSettings.ts b/models/inventory/Point of Sale/POSSettings.ts index 279b342f2..79b0b5112 100644 --- a/models/inventory/Point of Sale/POSSettings.ts +++ b/models/inventory/Point of Sale/POSSettings.ts @@ -11,9 +11,9 @@ export class POSSettings extends Doc { cashAccount?: string; writeOffAccount?: string; weightEnabledBarcode?: boolean; - checkDigit?: number; + checkDigits?: number; itemCodeDigits?: number; - itemWeight?: number; + itemWeightDigits?: number; posUI?: 'Classic' | 'Modern'; @@ -28,8 +28,8 @@ export class POSSettings extends Doc { hidden: HiddenMap = { weightEnabledBarcode: () => !this.fyo.singles.InventorySettings?.enableBarcodes, - checkDigit: () => !this.fyo.singles.InventorySettings?.enableBarcodes, + checkDigits: () => !this.fyo.singles.InventorySettings?.enableBarcodes, itemCodeDigits: () => !this.fyo.singles.InventorySettings?.enableBarcodes, - itemWeight: () => !this.fyo.singles.InventorySettings?.enableBarcodes, + itemWeightDigits: () => !this.fyo.singles.InventorySettings?.enableBarcodes, }; } diff --git a/schemas/app/inventory/Point of Sale/POSSettings.json b/schemas/app/inventory/Point of Sale/POSSettings.json index e23e2a2c6..18caa52ee 100644 --- a/schemas/app/inventory/Point of Sale/POSSettings.json +++ b/schemas/app/inventory/Point of Sale/POSSettings.json @@ -65,8 +65,8 @@ "section": "Barcode" }, { - "fieldname": "checkDigit", - "label": "Check Digit", + "fieldname": "checkDigits", + "label": "Check Digits", "fieldtype": "Int", "default": 0, "section": "Barcode" @@ -79,8 +79,8 @@ "section": "Barcode" }, { - "fieldname": "itemWeight", - "label": "item Weight", + "fieldname": "itemWeightDigits", + "label": "item Weight Digits", "fieldtype": "Int", "default": 0, "section": "Barcode" diff --git a/src/components/Controls/weightEnabledBarcode.vue b/src/components/Controls/weightEnabledBarcode.vue index f55cdcd81..19d566388 100644 --- a/src/components/Controls/weightEnabledBarcode.vue +++ b/src/components/Controls/weightEnabledBarcode.vue @@ -76,18 +76,19 @@ export default defineComponent({ const isWeightEnabled = this.fyo.singles.POSSettings?.weightEnabledBarcode; - const checkDigit = this.fyo.singles.POSSettings?.checkDigit as number; + const checkDigits = this.fyo.singles.POSSettings?.checkDigits as number; const itemCodeDigits = this.fyo.singles.POSSettings ?.itemCodeDigits as number; - const itemWeight = this.fyo.singles.POSSettings?.itemWeight as number; + const itemWeightDigits = this.fyo.singles.POSSettings + ?.itemWeightDigits as number; - if (code.length !== checkDigit + itemCodeDigits + itemWeight) { + if (code.length !== checkDigits + itemCodeDigits + itemWeightDigits) { return this.error(this.t`Barcode ${barcode} has an invalid length.`); } const filters: Record = isWeightEnabled ? { - barcode: barcode.slice(checkDigit, checkDigit + itemCodeDigits), + barcode: barcode.slice(checkDigits, checkDigits + itemCodeDigits), } : { barcode }; const fields = isWeightEnabled ? ['name', 'unit'] : ['name']; @@ -104,7 +105,7 @@ export default defineComponent({ ? this.parseBarcode( barcode, unit as string, - checkDigit + itemCodeDigits + checkDigits + itemCodeDigits ) : 1;