2022-04-19 05:59:36 +00:00
|
|
|
import { HiddenMap } from 'fyo/model/types';
|
2022-04-14 05:24:11 +00:00
|
|
|
import { Party as BaseParty } from 'models/baseModels/Party/Party';
|
|
|
|
import { GSTType } from './types';
|
|
|
|
|
|
|
|
export class Party extends BaseParty {
|
2022-05-17 12:12:57 +00:00
|
|
|
gstin?: string;
|
|
|
|
gstType?: GSTType;
|
|
|
|
|
2022-04-26 10:12:33 +00:00
|
|
|
async beforeSync() {
|
2022-04-14 05:24:11 +00:00
|
|
|
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',
|
|
|
|
};
|
|
|
|
}
|