mirror of
https://github.com/frappe/books.git
synced 2024-12-23 11:29:03 +00:00
Journal Entry DocType added
This commit is contained in:
parent
3b7182957a
commit
7bf0cf12d9
@ -23,6 +23,7 @@ module.exports = {
|
|||||||
frappe.desk.menu.addItem('Items', '#list/Item');
|
frappe.desk.menu.addItem('Items', '#list/Item');
|
||||||
frappe.desk.menu.addItem('Customers', '#list/Customer');
|
frappe.desk.menu.addItem('Customers', '#list/Customer');
|
||||||
frappe.desk.menu.addItem('Invoice', '#list/Invoice');
|
frappe.desk.menu.addItem('Invoice', '#list/Invoice');
|
||||||
|
frappe.desk.menu.addItem('Journal Entry', '#list/JournalEntry');
|
||||||
frappe.desk.menu.addItem('Address', "#list/Address");
|
frappe.desk.menu.addItem('Address', "#list/Address");
|
||||||
frappe.desk.menu.addItem('Contact', "#list/Contact");
|
frappe.desk.menu.addItem('Contact', "#list/Contact");
|
||||||
frappe.desk.menu.addItem('Settings', () => frappe.desk.showFormModal('SystemSettings'));
|
frappe.desk.menu.addItem('Settings', () => frappe.desk.showFormModal('SystemSettings'));
|
||||||
|
@ -104,7 +104,6 @@ module.exports = {
|
|||||||
return ['addressTitle', 'addressType'];
|
return ['addressTitle', 'addressType'];
|
||||||
},
|
},
|
||||||
getRowHTML(list, data) {
|
getRowHTML(list, data) {
|
||||||
console.log(list, data);
|
|
||||||
return `<div class="col-11">${list.getNameHTML(data)} (${data.addressType})</div>`;
|
return `<div class="col-11">${list.getNameHTML(data)} (${data.addressType})</div>`;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
83
models/doctype/JournalEntry/JournalEntry.js
Normal file
83
models/doctype/JournalEntry/JournalEntry.js
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
const frappe = require('frappejs');
|
||||||
|
const utils = require('../../../accounting/utils');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "JournalEntry",
|
||||||
|
doctype: "DocType",
|
||||||
|
isSingle: 0,
|
||||||
|
isChild: 0,
|
||||||
|
isSubmittable: 1,
|
||||||
|
keywordFields: ["name"],
|
||||||
|
showTitle: true,
|
||||||
|
settings: "JournalEntrySetting",
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
fieldname: "date",
|
||||||
|
label: "Date",
|
||||||
|
fieldtype: "Date"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldname: "entryType",
|
||||||
|
label: "Entry Type",
|
||||||
|
fieldtype: "Select",
|
||||||
|
options: [
|
||||||
|
"Journal Entry",
|
||||||
|
"Bank Entry",
|
||||||
|
"Cash Entry",
|
||||||
|
"Credit Card Entry",
|
||||||
|
"Debit Note",
|
||||||
|
"Credit Note",
|
||||||
|
"Contra Entry",
|
||||||
|
"Excise Entry",
|
||||||
|
"Write Off Entry",
|
||||||
|
"Opening Entry",
|
||||||
|
"Depreciation Entry"
|
||||||
|
],
|
||||||
|
required: 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldname: "accounts",
|
||||||
|
label: "Account Entries",
|
||||||
|
fieldtype: "Table",
|
||||||
|
childtype: "JournalEntryAccount",
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldname: "referenceNumber",
|
||||||
|
label: "Reference Number",
|
||||||
|
fieldtype: "Data",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldname: "referenceDate",
|
||||||
|
label: "Reference Date",
|
||||||
|
fieldtype: "Date",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldname: "userRemark",
|
||||||
|
label: "User Remark",
|
||||||
|
fieldtype: "Text",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
layout: [
|
||||||
|
// section 1
|
||||||
|
{
|
||||||
|
columns: [
|
||||||
|
{ fields: [ "date" ] },
|
||||||
|
{ fields: [ "entryType" ] },
|
||||||
|
]
|
||||||
|
|
||||||
|
},
|
||||||
|
// section 2
|
||||||
|
{ fields: ["accounts"]},
|
||||||
|
// section 3
|
||||||
|
{
|
||||||
|
columns: [
|
||||||
|
{ fields: [ "referenceNumber"] },
|
||||||
|
{ fields: [ "referenceDate"] }
|
||||||
|
|
||||||
|
]
|
||||||
|
},
|
||||||
|
// section 4
|
||||||
|
{ fields: [ "userRemark" ] },
|
||||||
|
]
|
||||||
|
}
|
29
models/doctype/JournalEntry/JournalEntryServer.js
Normal file
29
models/doctype/JournalEntry/JournalEntryServer.js
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
const BaseDocument = require('frappejs/model/document');
|
||||||
|
const frappe = require('frappejs');
|
||||||
|
const LedgerPosting = require.main.require('./accounting/ledgerPosting');
|
||||||
|
|
||||||
|
module.exports = class PaymentServer extends BaseDocument {
|
||||||
|
/**
|
||||||
|
|
||||||
|
getPosting() {
|
||||||
|
let entries = new LedgerPosting({reference: this, party: this.party});
|
||||||
|
entries.debit(this.paymentAccount, this.amount);
|
||||||
|
|
||||||
|
for (let row of this.for) {
|
||||||
|
entries.credit(this.account, row.amount, row.referenceType, row.referenceName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return entries;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async afterSubmit() {
|
||||||
|
await this.getPosting().post();
|
||||||
|
}
|
||||||
|
|
||||||
|
async afterRevert() {
|
||||||
|
await this.getPosting().postReverse();
|
||||||
|
}
|
||||||
|
|
||||||
|
**/
|
||||||
|
}
|
27
models/doctype/JournalEntryAccount/JournalEntryAccount.js
Normal file
27
models/doctype/JournalEntryAccount/JournalEntryAccount.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
module.exports = {
|
||||||
|
name: "JournalEntryAccount",
|
||||||
|
doctype: "DocType",
|
||||||
|
isSingle: 0,
|
||||||
|
isChild: 1,
|
||||||
|
keywordFields: [],
|
||||||
|
layout: 'ratio',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
"fieldname": "account",
|
||||||
|
"label": "Account",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"target": "Account",
|
||||||
|
"required": 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "debit",
|
||||||
|
"label": "Debit",
|
||||||
|
"fieldtype": "Currency"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "credit",
|
||||||
|
"label": "Credit",
|
||||||
|
"fieldtype": "Currency"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
18
models/doctype/JournalEntrySetting/JournalEntrySetting.js
Normal file
18
models/doctype/JournalEntrySetting/JournalEntrySetting.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
module.exports = {
|
||||||
|
"name": "JournalEntrySetting",
|
||||||
|
"label": "Journal Entry Setting",
|
||||||
|
"doctype": "DocType",
|
||||||
|
"isSingle": 1,
|
||||||
|
"isChild": 0,
|
||||||
|
"keywordFields": [],
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldname": "numberSeries",
|
||||||
|
"label": "Number Series",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"target": "NumberSeries",
|
||||||
|
"required": 1,
|
||||||
|
"default": "JV"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -17,7 +17,13 @@ module.exports = {
|
|||||||
Tax: require('./doctype/Tax/Tax.js'),
|
Tax: require('./doctype/Tax/Tax.js'),
|
||||||
TaxDetail: require('./doctype/TaxDetail/TaxDetail.js'),
|
TaxDetail: require('./doctype/TaxDetail/TaxDetail.js'),
|
||||||
TaxSummary: require('./doctype/TaxSummary/TaxSummary.js'),
|
TaxSummary: require('./doctype/TaxSummary/TaxSummary.js'),
|
||||||
|
|
||||||
Address: require('./doctype/Address/Address.js'),
|
Address: require('./doctype/Address/Address.js'),
|
||||||
Contact: require('./doctype/Contact/Contact.js')
|
Contact: require('./doctype/Contact/Contact.js'),
|
||||||
|
|
||||||
|
JournalEntry: require('./doctype/JournalEntry/JournalEntry.js'),
|
||||||
|
JournalEntryAccount: require('./doctype/JournalEntryAccount/JournalEntryAccount.js'),
|
||||||
|
JournalEntrySetting: require('./doctype/JournalEntrySetting/JournalEntrySetting.js'),
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ module.exports = {
|
|||||||
// set server-side modules
|
// set server-side modules
|
||||||
frappe.models.Invoice.documentClass = require('../models/doctype/Invoice/InvoiceServer.js');
|
frappe.models.Invoice.documentClass = require('../models/doctype/Invoice/InvoiceServer.js');
|
||||||
frappe.models.Payment.documentClass = require('../models/doctype/Payment/PaymentServer.js');
|
frappe.models.Payment.documentClass = require('../models/doctype/Payment/PaymentServer.js');
|
||||||
|
frappe.models.JournalEntry.documentClass = require('../models/doctype/JournalEntry/JournalEntryServer.js');
|
||||||
|
|
||||||
frappe.metaCache = {};
|
frappe.metaCache = {};
|
||||||
|
|
||||||
@ -23,6 +24,7 @@ module.exports = {
|
|||||||
// init naming series if missing
|
// init naming series if missing
|
||||||
await naming.createNumberSeries('INV-', 'InvoiceSetting');
|
await naming.createNumberSeries('INV-', 'InvoiceSetting');
|
||||||
await naming.createNumberSeries('PAY-', 'PaymentSetting');
|
await naming.createNumberSeries('PAY-', 'PaymentSetting');
|
||||||
|
await naming.createNumberSeries('JV-', 'JournalEntrySetting');
|
||||||
|
|
||||||
frappe.registerMethod({
|
frappe.registerMethod({
|
||||||
method: 'general-ledger',
|
method: 'general-ledger',
|
||||||
|
Loading…
Reference in New Issue
Block a user