2
0
mirror of https://github.com/frappe/books.git synced 2024-12-23 03:19:01 +00:00

fix: replace path after a doc has been inserted

- reword "Features Flags" to "Features"
- reword "Save to database"
- fix "New Entry" display
- fix address sectioning
This commit is contained in:
18alantom 2023-04-24 13:05:50 +05:30 committed by Alan
parent cb6aaaee31
commit eb2b6f4727
7 changed files with 33 additions and 17 deletions

View File

@ -70,14 +70,14 @@
"label": "Enable Discount Accounting", "label": "Enable Discount Accounting",
"fieldtype": "Check", "fieldtype": "Check",
"default": false, "default": false,
"section": "Feature Flags" "section": "Features"
}, },
{ {
"fieldname": "enableInventory", "fieldname": "enableInventory",
"label": "Enable Inventory", "label": "Enable Inventory",
"fieldtype": "Check", "fieldtype": "Check",
"default": false, "default": false,
"section": "Feature Flags" "section": "Features"
}, },
{ {
"fieldname": "fiscalYearStart", "fieldname": "fiscalYearStart",

View File

@ -55,24 +55,28 @@
"fieldname": "emailAddress", "fieldname": "emailAddress",
"label": "Email Address", "label": "Email Address",
"placeholder": "Email Address", "placeholder": "Email Address",
"fieldtype": "Data" "fieldtype": "Data",
"section": "Contacts"
}, },
{ {
"fieldname": "phone", "fieldname": "phone",
"label": "Phone", "label": "Phone",
"placeholder": "Phone", "placeholder": "Phone",
"fieldtype": "Data" "fieldtype": "Data",
"section": "Contacts"
}, },
{ {
"fieldname": "fax", "fieldname": "fax",
"label": "Fax", "label": "Fax",
"fieldtype": "Data" "fieldtype": "Data",
"section": "Contacts"
}, },
{ {
"fieldname": "addressDisplay", "fieldname": "addressDisplay",
"fieldtype": "Text", "fieldtype": "Text",
"label": "Address Display", "label": "Address Display",
"readOnly": true "readOnly": true,
"section": "Miscellaneous"
} }
], ],
"quickEditFields": [ "quickEditFields": [

View File

@ -55,19 +55,19 @@
"fieldname": "enableBarcodes", "fieldname": "enableBarcodes",
"label": "Enable Barcodes", "label": "Enable Barcodes",
"fieldtype": "Check", "fieldtype": "Check",
"section": "Feature Flags" "section": "Features"
}, },
{ {
"fieldname": "enableBatches", "fieldname": "enableBatches",
"label": "Enable Batches", "label": "Enable Batches",
"fieldtype": "Check", "fieldtype": "Check",
"section": "Feature Flags" "section": "Features"
}, },
{ {
"fieldname": "enableUomConversions", "fieldname": "enableUomConversions",
"label": "Enable UOM Conversion", "label": "Enable UOM Conversion",
"fieldtype": "Check", "fieldtype": "Check",
"section": "Feature Flags" "section": "Features"
} }
] ]
} }

View File

@ -5,7 +5,8 @@
"fieldname": "pos", "fieldname": "pos",
"label": "Place of Supply", "label": "Place of Supply",
"fieldtype": "AutoComplete", "fieldtype": "AutoComplete",
"placeholder": "Place of Supply" "placeholder": "Place of Supply",
"section": "Miscellaneous"
} }
], ],
"quickEditFields": [ "quickEditFields": [

View File

@ -168,6 +168,7 @@ import {
commonDocSync, commonDocSync,
getDocFromNameIfExistsElseNew, getDocFromNameIfExistsElseNew,
getFieldsGroupedByTabAndSection, getFieldsGroupedByTabAndSection,
getFormRoute,
getGroupedActionsForDoc, getGroupedActionsForDoc,
isPrintable, isPrintable,
routeTo, routeTo,
@ -227,6 +228,7 @@ export default defineComponent({
} }
await this.setDoc(); await this.setDoc();
this.replacePathAfterSync();
this.updateGroupedFields(); this.updateGroupedFields();
if (this.groupedFields) { if (this.groupedFields) {
this.activeTab = [...this.groupedFields.keys()][0]; this.activeTab = [...this.groupedFields.keys()][0];
@ -340,7 +342,7 @@ export default defineComponent({
return this.t`New Entry`; return this.t`New Entry`;
} }
return this.docOrNull?.name! ?? this.t`New Entry`; return this.docOrNull?.name || this.t`New Entry`;
}, },
schema(): Schema { schema(): Schema {
const schema = this.fyo.schemaMap[this.schemaName]; const schema = this.fyo.schemaMap[this.schemaName];
@ -403,6 +405,16 @@ export default defineComponent({
this.name this.name
); );
}, },
async replacePathAfterSync() {
if (!this.hasDoc || this.doc.inserted) {
return;
}
this.doc.once('afterSync', () => {
const route = getFormRoute(this.schemaName, this.doc.name!);
this.$router.replace(route);
});
},
async showRowEditForm(doc: Doc) { async showRowEditForm(doc: Doc) {
if (this.showLinks) { if (this.showLinks) {
this.showLinks = false; this.showLinks = false;

View File

@ -144,11 +144,6 @@ export default defineComponent({
const doc = fyo.doc.getNewDoc(this.schemaName, filters); const doc = fyo.doc.getNewDoc(this.schemaName, filters);
const route = getFormRoute(this.schemaName, doc.name!); const route = getFormRoute(this.schemaName, doc.name!);
await routeTo(route); await routeTo(route);
doc.on('afterSync', () => {
const route = getFormRoute(this.schemaName, doc.name!);
this.$router.replace(route);
});
}, },
applyFilter(filters: QueryFilter) { applyFilter(filters: QueryFilter) {
this.list?.updateData(filters); this.list?.updateData(filters);

View File

@ -550,7 +550,11 @@ async function showSubmitOrSyncDialog(doc: Doc, type: 'submit' | 'sync') {
title = t`Save ${label}?`; title = t`Save ${label}?`;
} }
let detail = t`Save ${doc.schema.label} to database.`; let detail = t`Create new ${doc.schema.label} entry.`;
if (type === 'sync' && doc.inserted) {
detail = t`Save changes made to ${label}.`;
}
if (type === 'submit') { if (type === 'submit') {
detail = getDocSubmitMessage(doc); detail = getDocSubmitMessage(doc);
} }