2
0
mirror of https://github.com/frappe/books.git synced 2025-01-05 16:12:21 +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 Normal View History

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