Skip to content

Commit

Permalink
feat: validate hsnCode
Browse files Browse the repository at this point in the history
  • Loading branch information
akshayitzme committed Nov 4, 2024
1 parent 73adacc commit dca298f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions models/baseModels/Item/Item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] {
Expand Down

0 comments on commit dca298f

Please sign in to comment.