2
0
mirror of https://github.com/frappe/books.git synced 2024-12-22 10:58:59 +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",
"fieldtype": "Check",
"default": false,
"section": "Feature Flags"
"section": "Features"
},
{
"fieldname": "enableInventory",
"label": "Enable Inventory",
"fieldtype": "Check",
"default": false,
"section": "Feature Flags"
"section": "Features"
},
{
"fieldname": "fiscalYearStart",

View File

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

View File

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

View File

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

View File

@ -168,6 +168,7 @@ import {
commonDocSync,
getDocFromNameIfExistsElseNew,
getFieldsGroupedByTabAndSection,
getFormRoute,
getGroupedActionsForDoc,
isPrintable,
routeTo,
@ -227,6 +228,7 @@ export default defineComponent({
}
await this.setDoc();
this.replacePathAfterSync();
this.updateGroupedFields();
if (this.groupedFields) {
this.activeTab = [...this.groupedFields.keys()][0];
@ -340,7 +342,7 @@ export default defineComponent({
return this.t`New Entry`;
}
return this.docOrNull?.name! ?? this.t`New Entry`;
return this.docOrNull?.name || this.t`New Entry`;
},
schema(): Schema {
const schema = this.fyo.schemaMap[this.schemaName];
@ -403,6 +405,16 @@ export default defineComponent({
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) {
if (this.showLinks) {
this.showLinks = false;

View File

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

View File

@ -550,7 +550,11 @@ async function showSubmitOrSyncDialog(doc: Doc, type: 'submit' | 'sync') {
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') {
detail = getDocSubmitMessage(doc);
}