2
0
mirror of https://github.com/frappe/books.git synced 2024-12-22 10:58:59 +00:00

feat: validate hsnCode

This commit is contained in:
akshayitzme 2024-11-04 12:49:07 +05:30
parent 73adacc784
commit dca298fa75

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[] {