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

formTitle for new doc

This commit is contained in:
Faris Ansari 2018-06-25 14:12:06 +05:30
parent 2827c97134
commit 0cef55e0aa

View File

@ -4,7 +4,7 @@
v-if="shouldRenderForm"
:doctype="doctype"
:name="name"
:title="doc[meta.titleField]"
:title="formTitle"
@save="save"
/>
<div class="p-3">
@ -23,6 +23,7 @@
import frappe from 'frappejs';
import FormLayout from './FormLayout';
import FormActions from './FormActions';
import { _ } from 'frappejs/utils';
export default {
name: 'Form',
@ -45,6 +46,12 @@ export default {
},
shouldRenderForm() {
return this.name && this.docLoaded;
},
formTitle() {
if (this.doc._notInserted) {
return _('New {0}', _(this.doctype));
}
return this.doc[this.meta.titleField];
}
},
async created() {