2
0
mirror of https://github.com/frappe/books.git synced 2025-01-27 09:08:24 +00:00
books/src/pages/Settings/TabGeneral.vue
2022-10-12 14:05:18 +05:30

52 lines
1.1 KiB
Vue

<script lang="ts">
import { Field } from 'schemas/types';
import { fyo } from 'src/initFyo';
import { defineComponent } from 'vue';
import TabBase from './TabBase.vue';
export default defineComponent({
extends: TabBase,
name: 'TabGeneral',
async mounted() {
this.doc = await fyo.doc.getDoc(
'AccountingSettings',
'AccountingSettings',
{
skipDocumentCache: true,
}
);
},
computed: {
fields() {
const fields = [
'fullname',
'companyName',
'country',
'bankName',
'currency',
'fiscalYearStart',
'fiscalYearEnd',
'writeOffAccount',
'roundOffAccount',
];
if (!this.doc?.enableDiscounting) {
fields.push('enableDiscounting');
}
if (this.doc?.enableDiscounting) {
fields.push('discountAccount');
}
if (fyo.singles.SystemSettings?.countryCode === 'in') {
fields.push('gstin');
}
return fields
.map((fieldname) => fyo.getField('AccountingSettings', fieldname))
.filter(Boolean) as Field[];
},
},
});
</script>