2
0
mirror of https://github.com/frappe/books.git synced 2025-01-24 15:48:25 +00:00

fix: reset template builder doc on navigating away

- add print templates to search
This commit is contained in:
18alantom 2023-05-09 09:53:32 +05:30
parent 2007e4339d
commit f6ce646477
2 changed files with 8 additions and 1 deletions

View File

@ -18,7 +18,7 @@
{{ t`Save as PDF` }} {{ t`Save as PDF` }}
</Button> </Button>
<Button <Button
v-if="doc && displayDoc" v-if="doc && doc.isCustom && displayDoc"
:title="t`Toggle Edit Mode`" :title="t`Toggle Edit Mode`"
:icon="true" :icon="true"
@click="toggleEditMode" @click="toggleEditMode"
@ -315,6 +315,7 @@ export default defineComponent({
} }
}, },
async activated(): Promise<void> { async activated(): Promise<void> {
await this.initialize();
docsPathRef.value = docsPathMap.PrintTemplate ?? ''; docsPathRef.value = docsPathMap.PrintTemplate ?? '';
this.setShortcuts(); this.setShortcuts();
}, },
@ -323,6 +324,7 @@ export default defineComponent({
if (this.editMode) { if (this.editMode) {
this.disableEditMode(); this.disableEditMode();
} }
this.reset();
}, },
methods: { methods: {
setShortcuts() { setShortcuts() {
@ -357,6 +359,10 @@ export default defineComponent({
await this.setDisplayInitialDoc(); await this.setDisplayInitialDoc();
}, },
reset() {
this.doc = null;
this.displayDoc = null;
},
getTemplateEditorState() { getTemplateEditorState() {
const fallback = this.doc?.template ?? ''; const fallback = this.doc?.template ?? '';

View File

@ -191,6 +191,7 @@ function getListViewList(fyo: Fyo): SearchItem[] {
ModelNameEnum.AccountingLedgerEntry, ModelNameEnum.AccountingLedgerEntry,
ModelNameEnum.Currency, ModelNameEnum.Currency,
ModelNameEnum.NumberSeries, ModelNameEnum.NumberSeries,
ModelNameEnum.PrintTemplate,
]; ];
const hasInventory = fyo.doc.singles.AccountingSettings?.enableInventory; const hasInventory = fyo.doc.singles.AccountingSettings?.enableInventory;