mirror of
https://github.com/frappe/books.git
synced 2024-11-10 07:40:55 +00:00
Merge branch 'master' into profit-and-loss
This commit is contained in:
commit
20db1fd391
@ -19,7 +19,9 @@ module.exports = {
|
||||
frappe.desk.menu.addItem('Chart of Accounts', '#tree/Account');
|
||||
frappe.desk.menu.addItem('Items', '#list/Item');
|
||||
frappe.desk.menu.addItem('Customers', '#list/Customer');
|
||||
frappe.desk.menu.addItem('Quotation', '#list/Quotation');
|
||||
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('Contact', "#list/Contact");
|
||||
frappe.desk.menu.addItem('Settings', () => frappe.desk.showFormModal('SystemSettings'));
|
||||
|
@ -104,7 +104,6 @@ module.exports = {
|
||||
return ['addressTitle', 'addressType'];
|
||||
},
|
||||
getRowHTML(list, data) {
|
||||
console.log(list, data);
|
||||
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/JournalEntrySettings/JournalEntrySettings.js
Normal file
18
models/doctype/JournalEntrySettings/JournalEntrySettings.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"
|
||||
}
|
||||
]
|
||||
}
|
8
models/doctype/Quotation/Quotation.js
Normal file
8
models/doctype/Quotation/Quotation.js
Normal file
@ -0,0 +1,8 @@
|
||||
const Invoice = require('../Invoice/Invoice');
|
||||
const Quotation = Invoice;
|
||||
|
||||
Quotation.name = "Quotation";
|
||||
Quotation.label = "Quotation";
|
||||
Quotation.settings = "QuotationSettings";
|
||||
|
||||
module.exports = Quotation;
|
8
models/doctype/QuotationSettings/QuotationSettings.js
Normal file
8
models/doctype/QuotationSettings/QuotationSettings.js
Normal file
@ -0,0 +1,8 @@
|
||||
const InvoiceSettings = require('../InvoiceSettings/InvoiceSettings');
|
||||
const QuotationSettings = InvoiceSettings;
|
||||
QuotationSettings.name = "QuotationSettings";
|
||||
QuotationSettings.label = "Quotation Settings";
|
||||
QuotationSettings.fields.find((field)=>{
|
||||
if (field.fieldname == "numberSeries") field.default = "QTN";
|
||||
});
|
||||
module.exports = QuotationSettings;
|
@ -18,7 +18,15 @@ module.exports = {
|
||||
Tax: require('./doctype/Tax/Tax.js'),
|
||||
TaxDetail: require('./doctype/TaxDetail/TaxDetail.js'),
|
||||
TaxSummary: require('./doctype/TaxSummary/TaxSummary.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'),
|
||||
JournalEntrySettings: require('./doctype/JournalEntrySettings/JournalEntrySettings.js'),
|
||||
|
||||
Quotation: require('./doctype/Quotation/Quotation.js'),
|
||||
QuotationSettings: require('./doctype/QuotationSettings/QuotationSettings.js'),
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ module.exports = {
|
||||
// set server-side modules
|
||||
frappe.models.Invoice.documentClass = require('../models/doctype/Invoice/InvoiceServer.js');
|
||||
frappe.models.Payment.documentClass = require('../models/doctype/Payment/PaymentServer.js');
|
||||
frappe.models.JournalEntry.documentClass = require('../models/doctype/JournalEntry/JournalEntryServer.js');
|
||||
|
||||
frappe.metaCache = {};
|
||||
|
||||
@ -31,6 +32,8 @@ module.exports = {
|
||||
// init naming series if missing
|
||||
await naming.createNumberSeries('INV-', 'InvoiceSettings');
|
||||
await naming.createNumberSeries('PAY-', 'PaymentSettings');
|
||||
await naming.createNumberSeries('JV-', 'JournalEntrySettings');
|
||||
await naming.createNumberSeries('QTN-', 'QuotationSettings');
|
||||
|
||||
frappe.registerMethod({
|
||||
method: 'general-ledger',
|
||||
|
Loading…
Reference in New Issue
Block a user