diff --git a/models/doctype/JournalEntry/JournalEntry.js b/models/doctype/JournalEntry/JournalEntry.js index 9d34c07c..5b969b2e 100644 --- a/models/doctype/JournalEntry/JournalEntry.js +++ b/models/doctype/JournalEntry/JournalEntry.js @@ -16,8 +16,8 @@ module.exports = { fieldname: 'entryType', label: 'Entry Type', fieldtype: 'Select', + placeholder: 'Entry Type', options: [ - 'Select...', 'Journal Entry', 'Bank Entry', 'Cash Entry', @@ -57,7 +57,8 @@ module.exports = { { fieldname: 'userRemark', label: 'User Remark', - fieldtype: 'Text' + fieldtype: 'Text', + placeholder: 'User Remark' } ], layout: [ diff --git a/models/doctype/JournalEntry/JournalEntryServer.js b/models/doctype/JournalEntry/JournalEntryServer.js index 545f8a56..62bd28da 100644 --- a/models/doctype/JournalEntry/JournalEntryServer.js +++ b/models/doctype/JournalEntry/JournalEntryServer.js @@ -3,25 +3,25 @@ const BaseDocument = require('frappejs/model/document'); const LedgerPosting = require('../../../accounting/ledgerPosting'); module.exports = class JournalEntryServer extends BaseDocument { - getPosting() { - let entries = new LedgerPosting({reference: this }); + getPosting() { + let entries = new LedgerPosting({ reference: this }); - for (let row of this.accounts) { - if (row.debit) { - entries.debit(row.account, row.debit); - } else if (row.credit) { - entries.credit(row.account, row.credit); - } - } - - return entries; + for (let row of this.accounts) { + if (row.debit) { + entries.debit(row.account, row.debit); + } else if (row.credit) { + entries.credit(row.account, row.credit); + } } - async afterSubmit() { - await this.getPosting().post(); - } + return entries; + } - async afterRevert() { - await this.getPosting().postReverse(); - } -} + async afterSubmit() { + await this.getPosting().post(); + } + + async afterRevert() { + await this.getPosting().postReverse(); + } +}; diff --git a/models/doctype/JournalEntryAccount/JournalEntryAccount.js b/models/doctype/JournalEntryAccount/JournalEntryAccount.js index 4b0d1b30..cb72e541 100644 --- a/models/doctype/JournalEntryAccount/JournalEntryAccount.js +++ b/models/doctype/JournalEntryAccount/JournalEntryAccount.js @@ -30,5 +30,6 @@ module.exports = { label: 'Credit', fieldtype: 'Currency' } - ] + ], + tableFields: ['account', 'debit', 'credit'] }; diff --git a/src/pages/JournalEntryForm.vue b/src/pages/JournalEntryForm.vue new file mode 100644 index 00000000..9793069a --- /dev/null +++ b/src/pages/JournalEntryForm.vue @@ -0,0 +1,218 @@ + + diff --git a/src/router.js b/src/router.js index 8003b836..2083af6c 100644 --- a/src/router.js +++ b/src/router.js @@ -15,6 +15,7 @@ import ReportList from '@/pages/ReportList'; import ChartOfAccounts from '@/pages/ChartOfAccounts'; import InvoiceForm from '@/pages/InvoiceForm'; +import JournalEntryForm from '@/pages/JournalEntryForm'; import Tree from 'frappejs/ui/components/Tree'; @@ -25,6 +26,18 @@ const routes = [ path: '/', component: Dashboard }, + { + path: '/edit/JournalEntry/:name', + name: 'JournalEntryForm', + components: { + default: JournalEntryForm, + edit: QuickEditForm + }, + props: { + default: true, + edit: route => route.query + } + }, { path: '/edit/:doctype/:name', name: 'InvoiceForm', @@ -78,11 +91,6 @@ const routes = [ name: 'Data Import', component: DataImport }, - // { - // path: '/settings', - // name: 'Settings', - // component: Settings - // }, { path: '/reportList', name: 'Report', @@ -111,7 +119,7 @@ const routes = [ let router = new Router({ routes }); if (process.env.NODE_ENV === 'development') { - window.router = router + window.router = router; } export default router;