2
0
mirror of https://github.com/frappe/books.git synced 2025-01-23 15:18:24 +00:00
books/models/baseModels/AppliedCouponCodes/AppliedCouponCodes.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
490 B
TypeScript
Raw Permalink Normal View History

2024-09-11 16:11:16 +05:30
import { DocValue } from 'fyo/core/types';
2024-09-11 16:08:41 +05:30
import { ValidationMap } from 'fyo/model/types';
import { InvoiceItem } from '../InvoiceItem/InvoiceItem';
2024-10-08 12:24:48 +05:30
import { validateCouponCode } from 'models/helpers';
2024-09-11 16:08:41 +05:30
export class AppliedCouponCodes extends InvoiceItem {
coupons?: string;
2024-09-11 16:11:16 +05:30
validations: ValidationMap = {
coupons: async (value: DocValue) => {
if (!value) {
return;
}
2024-10-08 12:24:48 +05:30
await validateCouponCode(this as AppliedCouponCodes, value as string);
2024-09-11 16:11:16 +05:30
},
};
2024-09-11 16:08:41 +05:30
}