diff --git a/models/doctype/Account/Account.js b/models/doctype/Account/Account.js
index 4aeb3242..fd04dc27 100644
--- a/models/doctype/Account/Account.js
+++ b/models/doctype/Account/Account.js
@@ -5,7 +5,8 @@ module.exports = {
"isSingle": 0,
"keywordFields": [
"name",
- "account_type"
+ "rootType",
+ "accountType"
],
"fields": [
{
@@ -15,7 +16,7 @@ module.exports = {
"required": 1
},
{
- "fieldname": "parent_account",
+ "fieldname": "parentAccount",
"label": "Parent Account",
"fieldtype": "Link",
"target": "Account",
@@ -27,8 +28,8 @@ module.exports = {
}
},
{
- "fieldname": "account_type",
- "label": "Account Type",
+ "fieldname": "rootType",
+ "label": "Root Type",
"fieldtype": "Select",
"options": [
"Asset",
@@ -37,6 +38,37 @@ module.exports = {
"Income",
"Expense"
]
+ },
+ {
+ "fieldname": "accountType",
+ "label": "Account Type",
+ "fieldtype": "Select",
+ "options": [
+ "Accumulated Depreciation",
+ "Bank",
+ "Cash",
+ "Chargeable",
+ "Cost of Goods Sold",
+ "Depreciation",
+ "Equity",
+ "Expense Account",
+ "Expenses Included In Valuation",
+ "Fixed Asset",
+ "Income Account",
+ "Payable",
+ "Receivable",
+ "Round Off",
+ "Stock",
+ "Stock Adjustment",
+ "Stock Received But Not Billed",
+ "Tax",
+ "Temporary"
+ ]
+ },
+ {
+ "fieldname": "isGroup",
+ "label": "Is Group",
+ "fieldtype": "Check"
}
],
@@ -48,10 +80,10 @@ module.exports = {
listSettings: {
getFields(list) {
- return ['name', 'account_type'];
+ return ['name', 'accountType', 'rootType'];
},
getRowHTML(list, data) {
- return `
${list.getNameHTML(data)} (${data.account_type})
`;
+ return `${list.getNameHTML(data)} (${data.rootType})
`;
}
}
}
\ No newline at end of file
diff --git a/models/doctype/Account/AccountDocument.js b/models/doctype/Account/AccountDocument.js
index 1a05abbe..527113dd 100644
--- a/models/doctype/Account/AccountDocument.js
+++ b/models/doctype/Account/AccountDocument.js
@@ -3,11 +3,11 @@ const BaseDocument = require('frappejs/model/document');
module.exports = class Account extends BaseDocument {
async validate() {
- if (!this.account_type) {
- if (this.parent_account) {
- this.account_type = await frappe.db.getValue('Account', this.parent_account, 'account_type');
+ if (!this.accountType) {
+ if (this.parentAccount) {
+ this.accountType = await frappe.db.getValue('Account', this.parentAccount, 'accountType');
} else {
- this.account_type = 'Asset';
+ this.accountType = 'Asset';
}
}
}
diff --git a/tests/testInvoice.js b/tests/testInvoice.js
index a322b1a4..1fca9709 100644
--- a/tests/testInvoice.js
+++ b/tests/testInvoice.js
@@ -8,7 +8,7 @@ async function makeFixtures() {
await frappe.insert({doctype:'Party', name:'Test Customer'})
await frappe.insert({doctype:'Item', name:'Test Item 1', description:'Test Item Description 1', unit:'No', rate: 100})
await frappe.insert({doctype:'Item', name:'Test Item 2', description:'Test Item Description 2', unit:'No', rate: 200})
- await frappe.insert({doctype:'Account', name:'GST', parent_account: 'Liabilities'});
+ await frappe.insert({doctype:'Account', name:'GST', parentAccount: 'Liabilities'});
await frappe.insert({doctype:'Tax', name:'GST',
details: [{account: 'GST', rate:10}]
})