mirror of
https://github.com/frappe/books.git
synced 2024-11-09 23:30:56 +00:00
camelify fieldnames in Account
This commit is contained in:
parent
56aa6c70af
commit
877e0616d4
@ -5,7 +5,8 @@ module.exports = {
|
|||||||
"isSingle": 0,
|
"isSingle": 0,
|
||||||
"keywordFields": [
|
"keywordFields": [
|
||||||
"name",
|
"name",
|
||||||
"account_type"
|
"rootType",
|
||||||
|
"accountType"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
@ -15,7 +16,7 @@ module.exports = {
|
|||||||
"required": 1
|
"required": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "parent_account",
|
"fieldname": "parentAccount",
|
||||||
"label": "Parent Account",
|
"label": "Parent Account",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"target": "Account",
|
"target": "Account",
|
||||||
@ -27,8 +28,8 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "account_type",
|
"fieldname": "rootType",
|
||||||
"label": "Account Type",
|
"label": "Root Type",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"options": [
|
"options": [
|
||||||
"Asset",
|
"Asset",
|
||||||
@ -37,6 +38,37 @@ module.exports = {
|
|||||||
"Income",
|
"Income",
|
||||||
"Expense"
|
"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: {
|
listSettings: {
|
||||||
getFields(list) {
|
getFields(list) {
|
||||||
return ['name', 'account_type'];
|
return ['name', 'accountType', 'rootType'];
|
||||||
},
|
},
|
||||||
getRowHTML(list, data) {
|
getRowHTML(list, data) {
|
||||||
return `<div class="col-11">${list.getNameHTML(data)} (${data.account_type})</div>`;
|
return `<div class="col-11">${list.getNameHTML(data)} (${data.rootType})</div>`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,11 +3,11 @@ const BaseDocument = require('frappejs/model/document');
|
|||||||
|
|
||||||
module.exports = class Account extends BaseDocument {
|
module.exports = class Account extends BaseDocument {
|
||||||
async validate() {
|
async validate() {
|
||||||
if (!this.account_type) {
|
if (!this.accountType) {
|
||||||
if (this.parent_account) {
|
if (this.parentAccount) {
|
||||||
this.account_type = await frappe.db.getValue('Account', this.parent_account, 'account_type');
|
this.accountType = await frappe.db.getValue('Account', this.parentAccount, 'accountType');
|
||||||
} else {
|
} else {
|
||||||
this.account_type = 'Asset';
|
this.accountType = 'Asset';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ async function makeFixtures() {
|
|||||||
await frappe.insert({doctype:'Party', name:'Test Customer'})
|
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 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:'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',
|
await frappe.insert({doctype:'Tax', name:'GST',
|
||||||
details: [{account: 'GST', rate:10}]
|
details: [{account: 'GST', rate:10}]
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user