2
0
mirror of https://github.com/frappe/books.git synced 2024-09-20 11:29:00 +00:00
books/models/regionalModels/in/Party.ts
18alantom 76bf6cfda5 incr: rem singleton from index.ts cause can't test
- update models to not use singleton export
2022-05-23 16:18:22 +05:30

19 lines
515 B
TypeScript

import { HiddenMap } from 'frappe/model/types';
import { Party as BaseParty } from 'models/baseModels/Party/Party';
import { GSTType } from './types';
export class Party extends BaseParty {
async beforeInsert() {
const gstin = this.get('gstin') as string | undefined;
const gstType = this.get('gstType') as GSTType;
if (gstin && gstType !== 'Registered Regular') {
this.gstin = '';
}
}
hidden: HiddenMap = {
gstin: () => (this.gstType as GSTType) !== 'Registered Regular',
};
}