feat: validate hsnCode

This commit is contained in:
akshayitzme
2024-11-04 12:49:07 +05:30
parent 73adacc784
commit dca298fa75
+5
View File
@@ -76,6 +76,11 @@ export class Item extends Doc {
throw new ValidationError(this.fyo.t`Rate can't be negative.`);
}
},
hsnCode: (value: DocValue) => {
if (value && !(value as string).match(/^\d{4,8}$/)) {
throw new ValidationError(this.fyo.t`Invalid HSN Code.`);
}
},
};
static getActions(fyo: Fyo): Action[] {