Skip to content

Commit

Permalink
fix: prevent adding items via barcode if not tracked in inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
AbleKSaju committed Jan 2, 2025
1 parent a07376b commit 26a5e02
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/components/Controls/WeightEnabledBarcode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,19 @@ export default defineComponent({
barcode: barcode.slice(checkDigits, checkDigits + itemCodeDigits),
}
: { barcode };
const fields = isWeightEnabled ? ['name', 'unit'] : ['name'];
const fields = isWeightEnabled
? ['name', 'unit', 'trackItem']
: ['name', 'trackItem'];
const items =
(await this.fyo.db.getAll('Item', { filters, fields })) || [];
const { name, unit } = items[0] || {};
const { name, unit, trackItem } = items[0] || {};
if (!trackItem) {
return this.error(
this.t`Item ${name as string} is not an Inventory Item.`
);
}
if (!name) {
return this.error(this.t`Item with barcode ${barcode} not found.`);
Expand Down

0 comments on commit 26a5e02

Please sign in to comment.