mirror of
https://github.com/frappe/books.git
synced 2024-12-22 19:09:01 +00:00
incr: add sections to settings
This commit is contained in:
parent
469a7c932b
commit
09f194badc
@ -5,87 +5,100 @@
|
||||
"isChild": false,
|
||||
"isSubmittable": false,
|
||||
"fields": [
|
||||
{
|
||||
"label": "Full Name",
|
||||
"fieldname": "fullname",
|
||||
"fieldtype": "Data",
|
||||
"required": true,
|
||||
"section": "Default"
|
||||
},
|
||||
{
|
||||
"label": "Company Name",
|
||||
"fieldname": "companyName",
|
||||
"fieldtype": "Data",
|
||||
"readOnly": true,
|
||||
"required": true
|
||||
"required": true,
|
||||
"section": "Default"
|
||||
},
|
||||
{
|
||||
"label": "Write Off Account",
|
||||
"fieldname": "writeOffAccount",
|
||||
"fieldtype": "Link",
|
||||
"target": "Account"
|
||||
"label": "Bank Name",
|
||||
"fieldname": "bankName",
|
||||
"fieldtype": "Data",
|
||||
"readOnly": true,
|
||||
"required": true,
|
||||
"section": "Default"
|
||||
},
|
||||
{
|
||||
"label": "Round Off Account",
|
||||
"fieldname": "roundOffAccount",
|
||||
"fieldtype": "Link",
|
||||
"target": "Account"
|
||||
},
|
||||
{
|
||||
"fieldname": "country",
|
||||
"label": "Country",
|
||||
"fieldname": "country",
|
||||
"fieldtype": "AutoComplete",
|
||||
"placeholder": "Select Country",
|
||||
"readOnly": true,
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"fieldname": "fullname",
|
||||
"label": "Full Name",
|
||||
"fieldtype": "Data",
|
||||
"required": true
|
||||
"required": true,
|
||||
"section": "Default"
|
||||
},
|
||||
{
|
||||
"fieldname": "email",
|
||||
"label": "Email",
|
||||
"fieldtype": "Data",
|
||||
"required": true
|
||||
"required": true,
|
||||
"section": "Default"
|
||||
},
|
||||
{
|
||||
"fieldname": "bankName",
|
||||
"label": "Bank Name",
|
||||
"fieldtype": "Data",
|
||||
"readOnly": true,
|
||||
"required": true
|
||||
"label": "Write Off Account",
|
||||
"fieldname": "writeOffAccount",
|
||||
"fieldtype": "Link",
|
||||
"target": "Account",
|
||||
"section": "Accounts"
|
||||
},
|
||||
{
|
||||
"fieldname": "fiscalYearStart",
|
||||
"label": "Fiscal Year Start Date",
|
||||
"fieldtype": "Date",
|
||||
"required": true
|
||||
"label": "Round Off Account",
|
||||
"fieldname": "roundOffAccount",
|
||||
"fieldtype": "Link",
|
||||
"target": "Account",
|
||||
"section": "Accounts"
|
||||
},
|
||||
{
|
||||
"fieldname": "fiscalYearEnd",
|
||||
"label": "Fiscal Year End Date",
|
||||
"fieldtype": "Date",
|
||||
"required": true
|
||||
"label": "Discount Account",
|
||||
"fieldname": "discountAccount",
|
||||
"fieldtype": "Link",
|
||||
"target": "Account",
|
||||
"section": "Accounts"
|
||||
},
|
||||
{
|
||||
"fieldname": "enableDiscounting",
|
||||
"label": "Enable Discount Accounting",
|
||||
"fieldtype": "Check",
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"fieldname": "discountAccount",
|
||||
"label": "Discount Account",
|
||||
"fieldtype": "Link",
|
||||
"target": "Account"
|
||||
"default": false,
|
||||
"section": "Feature Flags"
|
||||
},
|
||||
{
|
||||
"fieldname": "enableInventory",
|
||||
"label": "Enable Inventory",
|
||||
"fieldtype": "Check",
|
||||
"default": false
|
||||
"default": false,
|
||||
"section": "Feature Flags"
|
||||
},
|
||||
{
|
||||
"fieldname": "fiscalYearStart",
|
||||
"label": "Fiscal Year Start Date",
|
||||
"fieldtype": "Date",
|
||||
"required": true,
|
||||
"section": "Fiscal Year"
|
||||
},
|
||||
{
|
||||
"fieldname": "fiscalYearEnd",
|
||||
"label": "Fiscal Year End Date",
|
||||
"fieldtype": "Date",
|
||||
"required": true,
|
||||
"section": "Fiscal Year"
|
||||
},
|
||||
{
|
||||
"fieldname": "setupComplete",
|
||||
"label": "Setup Complete",
|
||||
"fieldtype": "Check",
|
||||
"default": false
|
||||
"default": false,
|
||||
"hidden": true
|
||||
}
|
||||
],
|
||||
"quickEditFields": [
|
||||
|
@ -9,73 +9,80 @@
|
||||
"label": "Sales Invoice Number Series",
|
||||
"fieldtype": "Link",
|
||||
"target": "NumberSeries",
|
||||
"create": true
|
||||
"create": true,
|
||||
"section": "Number Series"
|
||||
},
|
||||
{
|
||||
"fieldname": "purchaseInvoiceNumberSeries",
|
||||
"label": "Purchase Invoice Number Series",
|
||||
"fieldtype": "Link",
|
||||
"target": "NumberSeries",
|
||||
"create": true
|
||||
"create": true,
|
||||
"section": "Number Series"
|
||||
},
|
||||
{
|
||||
"fieldname": "journalEntryNumberSeries",
|
||||
"label": "Journal Entry Number Series",
|
||||
"fieldtype": "Link",
|
||||
"target": "NumberSeries",
|
||||
"create": true
|
||||
"create": true,
|
||||
"section": "Number Series"
|
||||
},
|
||||
{
|
||||
"fieldname": "paymentNumberSeries",
|
||||
"label": "Payment Number Series",
|
||||
"fieldtype": "Link",
|
||||
"target": "NumberSeries",
|
||||
"create": true
|
||||
"create": true,
|
||||
"section": "Number Series"
|
||||
},
|
||||
{
|
||||
"fieldname": "stockMovementNumberSeries",
|
||||
"label": "Stock Movement Number Series",
|
||||
"fieldtype": "Link",
|
||||
"target": "NumberSeries",
|
||||
"create": true
|
||||
"create": true,
|
||||
"section": "Number Series"
|
||||
},
|
||||
{
|
||||
"fieldname": "shipmentNumberSeries",
|
||||
"label": "Shipment Number Series",
|
||||
"fieldtype": "Link",
|
||||
"target": "NumberSeries",
|
||||
"create": true
|
||||
"create": true,
|
||||
"section": "Number Series"
|
||||
},
|
||||
{
|
||||
"fieldname": "purchaseReceiptNumberSeries",
|
||||
"label": "Purchase Receipt Number Series",
|
||||
"fieldtype": "Link",
|
||||
"target": "NumberSeries",
|
||||
"create": true
|
||||
"create": true,
|
||||
"section": "Number Series"
|
||||
},
|
||||
{
|
||||
"fieldname": "salesInvoiceTerms",
|
||||
"label": "Sales Invoice Terms",
|
||||
"fieldtype": "Text",
|
||||
"target": "NumberSeries"
|
||||
"section": "Terms"
|
||||
},
|
||||
{
|
||||
"fieldname": "purchaseInvoiceTerms",
|
||||
"label": "Purchase Invoice Terms",
|
||||
"fieldtype": "Text",
|
||||
"target": "NumberSeries"
|
||||
"section": "Terms"
|
||||
},
|
||||
{
|
||||
"fieldname": "shipmentTerms",
|
||||
"label": "Shipment Terms",
|
||||
"fieldtype": "Text",
|
||||
"target": "NumberSeries"
|
||||
"section": "Terms"
|
||||
},
|
||||
{
|
||||
"fieldname": "purchaseReceiptTerms",
|
||||
"label": "Purchase Receipt Terms",
|
||||
"fieldtype": "Text",
|
||||
"target": "NumberSeries"
|
||||
"section": "Terms"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -6,46 +6,36 @@
|
||||
{
|
||||
"fieldname": "logo",
|
||||
"label": "Logo",
|
||||
"fieldtype": "AttachImage"
|
||||
"fieldtype": "AttachImage",
|
||||
"section": "Default"
|
||||
},
|
||||
{
|
||||
"fieldname": "companyName",
|
||||
"label": "Company Name",
|
||||
"fieldtype": "Data"
|
||||
"fieldtype": "Data",
|
||||
"section": "Default"
|
||||
},
|
||||
{
|
||||
"fieldname": "email",
|
||||
"label": "Email",
|
||||
"fieldtype": "Data",
|
||||
"placeholder": "john@doe.com"
|
||||
},
|
||||
{
|
||||
"fieldname": "displayLogo",
|
||||
"label": "Display Logo in Invoice",
|
||||
"fieldtype": "Check"
|
||||
},
|
||||
{
|
||||
"fieldname": "displayTaxInvoice",
|
||||
"label": "Display Tax Invoice",
|
||||
"fieldtype": "Check"
|
||||
},
|
||||
{
|
||||
"fieldname": "displayBatch",
|
||||
"label": "Display Batch",
|
||||
"fieldtype": "Check"
|
||||
"placeholder": "john@doe.com",
|
||||
"section": "Contacts"
|
||||
},
|
||||
{
|
||||
"fieldname": "phone",
|
||||
"label": "Phone",
|
||||
"fieldtype": "Data",
|
||||
"placeholder": "9888900000"
|
||||
"placeholder": "9888900000",
|
||||
"section": "Contacts"
|
||||
},
|
||||
{
|
||||
"fieldname": "address",
|
||||
"label": "Address",
|
||||
"fieldtype": "Link",
|
||||
"target": "Address",
|
||||
"inline": true
|
||||
"inline": true,
|
||||
"section": "Contacts"
|
||||
},
|
||||
{
|
||||
"fieldname": "template",
|
||||
@ -66,7 +56,8 @@
|
||||
"label": "Business"
|
||||
}
|
||||
],
|
||||
"default": "Basic"
|
||||
"default": "Basic",
|
||||
"section": "Customizations"
|
||||
},
|
||||
{
|
||||
"fieldname": "color",
|
||||
@ -115,7 +106,8 @@
|
||||
"label": "Black",
|
||||
"value": "#112B42"
|
||||
}
|
||||
]
|
||||
],
|
||||
"section": "Customizations"
|
||||
},
|
||||
{
|
||||
"fieldname": "font",
|
||||
@ -136,7 +128,26 @@
|
||||
"label": "Courier"
|
||||
}
|
||||
],
|
||||
"default": "Arial"
|
||||
"default": "Arial",
|
||||
"section": "Customizations"
|
||||
},
|
||||
{
|
||||
"fieldname": "displayLogo",
|
||||
"label": "Display Logo in Invoice",
|
||||
"fieldtype": "Check",
|
||||
"section": "Customizations"
|
||||
},
|
||||
{
|
||||
"fieldname": "displayTaxInvoice",
|
||||
"label": "Display Tax Invoice",
|
||||
"fieldtype": "Check",
|
||||
"section": "Customizations"
|
||||
},
|
||||
{
|
||||
"fieldname": "displayBatch",
|
||||
"label": "Display Batch",
|
||||
"fieldtype": "Check",
|
||||
"section": "Customizations"
|
||||
}
|
||||
],
|
||||
"quickEditFields": [
|
||||
|
@ -19,47 +19,55 @@
|
||||
}
|
||||
],
|
||||
"default": "FIFO",
|
||||
"required": true
|
||||
"required": true,
|
||||
"section": "Default"
|
||||
},
|
||||
{
|
||||
"fieldname": "defaultLocation",
|
||||
"label": "Default Location",
|
||||
"fieldtype": "Link",
|
||||
"target": "Location",
|
||||
"create": true
|
||||
"create": true,
|
||||
"section": "Default"
|
||||
},
|
||||
{
|
||||
"fieldname": "stockInHand",
|
||||
"label": "Stock In Hand Acc.",
|
||||
"fieldtype": "Link",
|
||||
"target": "Account"
|
||||
"target": "Account",
|
||||
"section": "Accounts"
|
||||
},
|
||||
{
|
||||
"fieldname": "stockReceivedButNotBilled",
|
||||
"label": "Stock Received But Not Billed Acc.",
|
||||
"fieldtype": "Link",
|
||||
"target": "Account"
|
||||
"target": "Account",
|
||||
"section": "Accounts"
|
||||
},
|
||||
{
|
||||
"fieldname": "costOfGoodsSold",
|
||||
"label": "Cost Of Goods Sold Acc.",
|
||||
"fieldtype": "Link",
|
||||
"target": "Account"
|
||||
"target": "Account",
|
||||
"section": "Accounts"
|
||||
},
|
||||
{
|
||||
"fieldname": "enableBarcodes",
|
||||
"label": "Enable Barcodes",
|
||||
"fieldtype": "Check"
|
||||
"fieldtype": "Check",
|
||||
"section": "Feature Flags"
|
||||
},
|
||||
{
|
||||
"fieldname": "enableBatches",
|
||||
"label": "Enable Batches",
|
||||
"fieldtype": "Check"
|
||||
"fieldtype": "Check",
|
||||
"section": "Feature Flags"
|
||||
},
|
||||
{
|
||||
"fieldname": "enableUomConversions",
|
||||
"label": "Enable UOM Conversion",
|
||||
"fieldtype": "Check"
|
||||
"fieldtype": "Check",
|
||||
"section": "Feature Flags"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -45,7 +45,23 @@
|
||||
"default": "MMM d, y",
|
||||
"required": true,
|
||||
"allowCustom": true,
|
||||
"description": "Sets the app-wide date display format."
|
||||
"description": "Sets the app-wide date display format.",
|
||||
"section": "Default"
|
||||
},
|
||||
{
|
||||
"fieldname": "hideGetStarted",
|
||||
"label": "Hide Get Started",
|
||||
"fieldtype": "Check",
|
||||
"default": false,
|
||||
"description": "Hides the Get Started section from the sidebar. Change will be visible on restart or refreshing the app.",
|
||||
"section": "Default"
|
||||
},
|
||||
{
|
||||
"fieldname": "version",
|
||||
"label": "Version",
|
||||
"fieldtype": "Data",
|
||||
"readOnly": true,
|
||||
"section": "Default"
|
||||
},
|
||||
{
|
||||
"fieldname": "locale",
|
||||
@ -54,7 +70,8 @@
|
||||
"default": "en-IN",
|
||||
"required": true,
|
||||
"allowCustom": true,
|
||||
"description": "Set the local code. This is used for number formatting."
|
||||
"description": "Set the local code. This is used for number formatting.",
|
||||
"section": "Number Display"
|
||||
},
|
||||
{
|
||||
"fieldname": "displayPrecision",
|
||||
@ -64,29 +81,8 @@
|
||||
"required": true,
|
||||
"minvalue": 0,
|
||||
"maxvalue": 9,
|
||||
"description": "Sets how many digits are shown after the decimal point."
|
||||
},
|
||||
{
|
||||
"fieldname": "internalPrecision",
|
||||
"label": "Internal Precision",
|
||||
"fieldtype": "Int",
|
||||
"minvalue": 0,
|
||||
"default": 11,
|
||||
"description": "Sets the internal precision used for monetary calculations. Above 6 should be sufficient for most currencies."
|
||||
},
|
||||
{
|
||||
"fieldname": "hideGetStarted",
|
||||
"label": "Hide Get Started",
|
||||
"fieldtype": "Check",
|
||||
"default": false,
|
||||
"description": "Hides the Get Started section from the sidebar. Change will be visible on restart or refreshing the app."
|
||||
},
|
||||
{
|
||||
"fieldname": "countryCode",
|
||||
"label": "Country Code",
|
||||
"fieldtype": "Data",
|
||||
"default": "in",
|
||||
"description": "Country code used to initialize regional settings."
|
||||
"description": "Sets how many digits are shown after the decimal point.",
|
||||
"section": "Number Display"
|
||||
},
|
||||
{
|
||||
"fieldname": "currency",
|
||||
@ -94,19 +90,32 @@
|
||||
"fieldtype": "AutoComplete",
|
||||
"default": "INR",
|
||||
"readOnly": true,
|
||||
"required": true
|
||||
"required": true,
|
||||
"section": "Number Display"
|
||||
},
|
||||
{
|
||||
"fieldname": "version",
|
||||
"label": "Version",
|
||||
"fieldname": "internalPrecision",
|
||||
"label": "Internal Precision",
|
||||
"fieldtype": "Int",
|
||||
"minvalue": 0,
|
||||
"default": 11,
|
||||
"description": "Sets the internal precision used for monetary calculations. Above 6 should be sufficient for most currencies.",
|
||||
"hidden": true
|
||||
},
|
||||
{
|
||||
"fieldname": "countryCode",
|
||||
"label": "Country Code",
|
||||
"fieldtype": "Data",
|
||||
"readOnly": true
|
||||
"default": "in",
|
||||
"description": "Country code used to initialize regional settings.",
|
||||
"hidden": true
|
||||
},
|
||||
{
|
||||
"fieldname": "instanceId",
|
||||
"label": "Instance Id",
|
||||
"fieldtype": "Data",
|
||||
"readOnly": true
|
||||
"readOnly": true,
|
||||
"hidden": true
|
||||
}
|
||||
],
|
||||
"quickEditFields": [
|
||||
|
@ -5,7 +5,8 @@
|
||||
"fieldname": "gstin",
|
||||
"label": "GSTIN",
|
||||
"fieldtype": "Data",
|
||||
"placeholder": "27AAAAA0000A1Z5"
|
||||
"placeholder": "27AAAAA0000A1Z5",
|
||||
"section": "Default"
|
||||
}
|
||||
],
|
||||
"quickEditFields": [
|
||||
|
@ -82,7 +82,7 @@ import { evaluateHidden } from 'src/utils/doc';
|
||||
import { reloadWindow } from 'src/utils/ipcCalls';
|
||||
import { UIGroupedFields } from 'src/utils/types';
|
||||
import { showToast } from 'src/utils/ui';
|
||||
import { defineComponent, nextTick } from 'vue';
|
||||
import { computed, defineComponent, nextTick } from 'vue';
|
||||
import CommonFormSection from '../CommonForm/CommonFormSection.vue';
|
||||
|
||||
export default defineComponent({
|
||||
@ -102,15 +102,19 @@ export default defineComponent({
|
||||
quickEditDoc: null | Doc;
|
||||
};
|
||||
},
|
||||
provide() {
|
||||
return { doc: computed(() => this.doc) };
|
||||
},
|
||||
mounted() {
|
||||
this.updateGroupedFields();
|
||||
if (this.fyo.store.isDevelopment) {
|
||||
// @ts-ignore
|
||||
window.settings = this;
|
||||
}
|
||||
|
||||
this.update();
|
||||
},
|
||||
methods: {
|
||||
async sync() {
|
||||
async sync(): Promise<void> {
|
||||
const syncableDocs = this.schemas
|
||||
.map(({ name }) => this.fyo.singles[name])
|
||||
.filter((doc) => doc?.canSave) as Doc[];
|
||||
@ -127,7 +131,7 @@ export default defineComponent({
|
||||
action: reloadWindow,
|
||||
});
|
||||
},
|
||||
async syncDoc(doc: Doc) {
|
||||
async syncDoc(doc: Doc): Promise<void> {
|
||||
try {
|
||||
await doc.sync();
|
||||
this.updateGroupedFields();
|
||||
@ -139,7 +143,7 @@ export default defineComponent({
|
||||
await handleErrorWithDialog(err, doc);
|
||||
}
|
||||
},
|
||||
async toggleQuickEditDoc(doc: Doc | null) {
|
||||
async toggleQuickEditDoc(doc: Doc | null): Promise<void> {
|
||||
if (this.quickEditDoc && doc) {
|
||||
this.quickEditDoc = null;
|
||||
await nextTick();
|
||||
@ -147,7 +151,7 @@ export default defineComponent({
|
||||
|
||||
this.quickEditDoc = doc;
|
||||
},
|
||||
async onValueChange(field: Field, value: DocValue) {
|
||||
async onValueChange(field: Field, value: DocValue): Promise<void> {
|
||||
const { fieldname } = field;
|
||||
delete this.errors[fieldname];
|
||||
|
||||
@ -163,16 +167,16 @@ export default defineComponent({
|
||||
|
||||
this.update();
|
||||
},
|
||||
update() {
|
||||
update(): void {
|
||||
this.updateCanSave();
|
||||
this.updateGroupedFields();
|
||||
},
|
||||
updateCanSave() {
|
||||
updateCanSave(): void {
|
||||
this.canSave = this.schemas
|
||||
.map(({ name }) => this.fyo.singles[name]?.canSave)
|
||||
.some(Boolean);
|
||||
},
|
||||
updateGroupedFields() {
|
||||
updateGroupedFields(): void {
|
||||
const grouped: UIGroupedFields = new Map();
|
||||
const fields: Field[] = this.schemas.map((s) => s.fields).flat();
|
||||
|
||||
@ -183,7 +187,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
const tabbed = grouped.get(schemaName)!;
|
||||
const section = field.section ?? this.t`Misc`;
|
||||
const section = field.section ?? this.t`Miscellaneous`;
|
||||
if (!tabbed.has(section)) {
|
||||
tabbed.set(section, []);
|
||||
}
|
||||
@ -214,7 +218,7 @@ export default defineComponent({
|
||||
},
|
||||
tabLabels(): Record<string, string> {
|
||||
return {
|
||||
[ModelNameEnum.AccountingSettings]: this.t`Accounting`,
|
||||
[ModelNameEnum.AccountingSettings]: this.t`General`,
|
||||
[ModelNameEnum.PrintSettings]: this.t`Print`,
|
||||
[ModelNameEnum.InventorySettings]: this.t`Inventory`,
|
||||
[ModelNameEnum.Defaults]: this.t`Defaults`,
|
||||
@ -227,9 +231,9 @@ export default defineComponent({
|
||||
|
||||
return [
|
||||
ModelNameEnum.AccountingSettings,
|
||||
ModelNameEnum.PrintSettings,
|
||||
ModelNameEnum.InventorySettings,
|
||||
ModelNameEnum.Defaults,
|
||||
ModelNameEnum.PrintSettings,
|
||||
ModelNameEnum.SystemSettings,
|
||||
]
|
||||
.filter((s) =>
|
||||
@ -237,7 +241,7 @@ export default defineComponent({
|
||||
)
|
||||
.map((s) => this.fyo.schemaMap[s]!);
|
||||
},
|
||||
activeGroup() {
|
||||
activeGroup(): Map<string, Field[]> {
|
||||
if (!this.groupedFields) {
|
||||
return new Map();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user