mirror of
https://github.com/frappe/books.git
synced 2025-01-23 23:28:24 +00:00
fix: prevent adding items via barcode if not tracked in inventory
This commit is contained in:
parent
a07376b460
commit
26a5e02c51
@ -92,11 +92,19 @@ export default defineComponent({
|
|||||||
barcode: barcode.slice(checkDigits, checkDigits + itemCodeDigits),
|
barcode: barcode.slice(checkDigits, checkDigits + itemCodeDigits),
|
||||||
}
|
}
|
||||||
: { barcode };
|
: { barcode };
|
||||||
const fields = isWeightEnabled ? ['name', 'unit'] : ['name'];
|
const fields = isWeightEnabled
|
||||||
|
? ['name', 'unit', 'trackItem']
|
||||||
|
: ['name', 'trackItem'];
|
||||||
|
|
||||||
const items =
|
const items =
|
||||||
(await this.fyo.db.getAll('Item', { filters, fields })) || [];
|
(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) {
|
if (!name) {
|
||||||
return this.error(this.t`Item with barcode ${barcode} not found.`);
|
return this.error(this.t`Item with barcode ${barcode} not found.`);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user