2
0
mirror of https://github.com/frappe/books.git synced 2025-01-08 17:24:05 +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` }}
</Button>
<Button
v-if="doc && displayDoc"
v-if="doc && doc.isCustom && displayDoc"
:title="t`Toggle Edit Mode`"
:icon="true"
@click="toggleEditMode"
@ -315,6 +315,7 @@ export default defineComponent({
}
},
async activated(): Promise<void> {
await this.initialize();
docsPathRef.value = docsPathMap.PrintTemplate ?? '';
this.setShortcuts();
},
@ -323,6 +324,7 @@ export default defineComponent({
if (this.editMode) {
this.disableEditMode();
}
this.reset();
},
methods: {
setShortcuts() {
@ -357,6 +359,10 @@ export default defineComponent({
await this.setDisplayInitialDoc();
},
reset() {
this.doc = null;
this.displayDoc = null;
},
getTemplateEditorState() {
const fallback = this.doc?.template ?? '';

View File

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