2
0
mirror of https://github.com/frappe/books.git synced 2024-11-14 01:14:03 +00:00

added new model item

This commit is contained in:
Rushabh Mehta 2018-01-25 15:35:24 +05:30
parent 72902cdeb8
commit 61b3facf16
5 changed files with 379 additions and 121 deletions

View File

@ -11,11 +11,13 @@ client.start({
// require modules
frappe.modules.todo = require('frappejs/models/doctype/todo/todo.js');
frappe.modules.account = require('./models/doctype/account/account.js');
frappe.modules.item = require('./models/doctype/item/item.js');
frappe.modules.todo_client = require('frappejs/models/doctype/todo/todo_client.js');
frappe.modules.account_client = require('./models/doctype/account/account_client.js');
frappe.desk.add_sidebar_item('ToDo', '#list/todo');
frappe.desk.add_sidebar_item('Accounts', '#list/account');
frappe.desk.add_sidebar_item('Items', '#list/item');
frappe.router.default = '#list/todo';

File diff suppressed because one or more lines are too long

View File

@ -12,7 +12,7 @@ class AccountList extends BaseList {
class AccountForm extends BaseForm {
make() {
this.super();
super.make();
// override controller event
this.controls['parent_account'].get_filters = (query) => {

View File

@ -0,0 +1,16 @@
const BaseMeta = require('frappejs/model/meta');
const BaseDocument = require('frappejs/model/document');
class ItemMeta extends BaseMeta {
setup_meta() {
Object.assign(this, require('./item.json'));
}
}
class Item extends BaseDocument {
}
module.exports = {
Document: Item,
Meta: ItemMeta
};

View File

@ -0,0 +1,39 @@
{
"name": "Item",
"doctype": "DocType",
"issingle": 0,
"keyword_fields": [
"name",
"description"
],
"fields": [
{
"fieldname": "name",
"label": "Item Name",
"fieldtype": "Data",
"reqd": 1
},
{
"fieldname": "description",
"label": "Description",
"fieldtype": "Text"
},
{
"fieldname": "unit",
"label": "Unit",
"fieldtype": "Select",
"options": [
"No",
"Kg",
"Gram",
"Hour",
"Day"
]
},
{
"fieldname": "rate",
"label": "Rate",
"fieldtype": "Currency"
}
]
}