Skip to content

Commit

Permalink
fix: renamed filename & label from itemWeight to itemWeightDigits
Browse files Browse the repository at this point in the history
  • Loading branch information
AbleKSaju committed Jan 2, 2025
1 parent 618457f commit cd45653
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
8 changes: 4 additions & 4 deletions models/inventory/Point of Sale/POSSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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,
};
}
8 changes: 4 additions & 4 deletions schemas/app/inventory/Point of Sale/POSSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
"section": "Barcode"
},
{
"fieldname": "checkDigit",
"label": "Check Digit",
"fieldname": "checkDigits",
"label": "Check Digits",
"fieldtype": "Int",
"default": 0,
"section": "Barcode"
Expand All @@ -79,8 +79,8 @@
"section": "Barcode"
},
{
"fieldname": "itemWeight",
"label": "item Weight",
"fieldname": "itemWeightDigits",
"label": "item Weight Digits",
"fieldtype": "Int",
"default": 0,
"section": "Barcode"
Expand Down
11 changes: 6 additions & 5 deletions src/components/Controls/weightEnabledBarcode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string> = isWeightEnabled
? {
barcode: barcode.slice(checkDigit, checkDigit + itemCodeDigits),
barcode: barcode.slice(checkDigits, checkDigits + itemCodeDigits),
}
: { barcode };
const fields = isWeightEnabled ? ['name', 'unit'] : ['name'];
Expand All @@ -104,7 +105,7 @@ export default defineComponent({
? this.parseBarcode(
barcode,
unit as string,
checkDigit + itemCodeDigits
checkDigits + itemCodeDigits
)
: 1;
Expand Down

0 comments on commit cd45653

Please sign in to comment.