2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00

added fetch

This commit is contained in:
Rushabh Mehta 2018-02-09 18:26:10 +05:30
parent 85693672cc
commit cf5f029ea0
9 changed files with 297 additions and 200 deletions

10
dist/css/style.css vendored
View File

@ -5735,9 +5735,13 @@ a.text-dark:hover, a.text-dark:focus {
background: #3d6b00;
color: inherit; }
html {
font-size: 16px; }
font-size: 14px; }
.main {
border-left: 1px solid #dee2e6; }
.sidebar .list-group-item {
padding: 0.5rem 1rem; }
.sidebar .list-group-flush {
margin: -1rem; }
.hide {
display: none !important; }
.page-head {
@ -5780,8 +5784,8 @@ mark {
color: inherit;
padding: 0px; }
.table-wrapper {
margin-top: 1rem;
margin-bottom: 1rem; }
margin-top: 2rem;
margin-bottom: 2rem; }
.table-toolbar {
margin-top: 0.5rem; }
.data-table-col .edit-cell {

445
dist/js/bundle.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@
"fieldname": "name",
"label": "Account Name",
"fieldtype": "Data",
"reqd": 1
"required": 1
},
{
"fieldname": "parent_account",

View File

@ -11,7 +11,7 @@
"fieldname": "name",
"label": "Name",
"fieldtype": "Data",
"reqd": 1
"required": 1
}
]
}

View File

@ -8,9 +8,6 @@ class InvoiceMeta extends BaseMeta {
}
class Invoice extends BaseDocument {
get_total() {
return this.items.map(d => (d.amount || 0)).reduce((a, b) => a + b, 0);
}
}
module.exports = {

View File

@ -10,21 +10,22 @@
"label": "Customer",
"fieldtype": "Link",
"target": "Customer",
"reqd": 1
"required": 1
},
{
"fieldname": "items",
"label": "Items",
"fieldtype": "Table",
"childtype": "Invoice Item",
"reqd": 1
"required": true
},
{
"fieldname": "total",
"label": "Total",
"fieldtype": "Currency",
"formula": "doc.get_total()",
"reqd": 1
"formula": "doc.getSum('items', 'amount')",
"required": true,
"disabled": true
}
]
}

View File

@ -10,33 +10,33 @@
"label": "Item",
"fieldtype": "Link",
"target": "Item",
"reqd": 1
"required": 1
},
{
"fieldname": "description",
"label": "Description",
"fieldtype": "Text",
"fetch": {"from": "item", "value": "description"},
"reqd": 1
"formula": "doc.getFrom('Item', row.item, 'description')",
"required": 1
},
{
"fieldname": "quantity",
"label": "Quantity",
"fieldtype": "Float",
"reqd": 1
"required": 1
},
{
"fieldname": "rate",
"label": "Rate",
"fieldtype": "Currency",
"reqd": 1
"required": 1
},
{
"fieldname": "amount",
"label": "Amount",
"fieldtype": "Currency",
"read_only": 1,
"formula": "doc.quantity * doc.rate"
"disabled": 1,
"formula": "row.quantity * row.rate"
}
]
}

View File

@ -11,7 +11,7 @@
"fieldname": "name",
"label": "Item Name",
"fieldtype": "Data",
"reqd": 1
"required": 1
},
{
"fieldname": "description",

View File

@ -17,11 +17,11 @@ client.start({
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.desk.add_sidebar_item('Customers', '#list/customer');
frappe.desk.add_sidebar_item('Invoice', '#list/invoice');
frappe.desk.addSidebarItem('ToDo', '#list/todo');
frappe.desk.addSidebarItem('Accounts', '#list/account');
frappe.desk.addSidebarItem('Items', '#list/item');
frappe.desk.addSidebarItem('Customers', '#list/customer');
frappe.desk.addSidebarItem('Invoice', '#list/invoice');
frappe.router.default = '#list/todo';