2
0
mirror of https://github.com/frappe/books.git synced 2024-09-20 03:29:00 +00:00

add new model, account

This commit is contained in:
Rushabh Mehta 2018-01-23 13:30:13 +05:30
parent 55e4a350e3
commit fed69e1a3a
2 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,26 @@
const frappe = require('frappejs');
class account_meta extends frappe.meta.Meta {
setup_meta() {
Object.assign(this, require('./account.json'));
this.list_options.fields = ['name', 'account_type'];
}
get_row_html(data) {
return `<a href="#edit/account/${data.name}">${data.name} (${data.account_type})</a>`;
}
}
class account extends frappe.document.Document {
setup() {
this.add_handler('validate');
}
validate() {
if (!this.account_type) {
this.status = 'Asset';
}
}
}
module.exports = {account:account, account_meta:account_meta};

View File

@ -0,0 +1,29 @@
{
"name": "Account",
"doctype": "DocType",
"issingle": 0,
"keyword_fields": [
"name",
"account_type"
],
"fields": [
{
"fieldname": "name",
"label": "Account Name",
"fieldtype": "Data",
"reqd": 1
},
{
"fieldname": "account_type",
"label": "Account Type",
"fieldtype": "Select",
"options": [
"Asset",
"Liability",
"Equity",
"Income",
"Expense"
]
}
]
}