mirror of
https://github.com/frappe/books.git
synced 2024-12-23 03:19:01 +00:00
Merge pull request #23 from revant/fix_case
Models for Address and Contact
This commit is contained in:
commit
3b7182957a
@ -23,6 +23,8 @@ module.exports = {
|
||||
frappe.desk.menu.addItem('Items', '#list/Item');
|
||||
frappe.desk.menu.addItem('Customers', '#list/Customer');
|
||||
frappe.desk.menu.addItem('Invoice', '#list/Invoice');
|
||||
frappe.desk.menu.addItem('Address', "#list/Address");
|
||||
frappe.desk.menu.addItem('Contact', "#list/Contact");
|
||||
frappe.desk.menu.addItem('Settings', () => frappe.desk.showFormModal('SystemSettings'));
|
||||
|
||||
frappe.router.default = '#list/ToDo';
|
||||
|
125
models/doctype/Address/Address.js
Normal file
125
models/doctype/Address/Address.js
Normal file
@ -0,0 +1,125 @@
|
||||
module.exports = {
|
||||
"name": "Address",
|
||||
"doctype": "DocType",
|
||||
"isSingle": 0,
|
||||
"titleField": "addressTitle",
|
||||
"keywordFields": [
|
||||
"addressTitle"
|
||||
],
|
||||
pageSettings: {
|
||||
hideTitle: true
|
||||
},
|
||||
"naming": "autoincrement",
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "addressTitle",
|
||||
"label": "Address Title",
|
||||
"fieldtype": "Data",
|
||||
"required": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "addressType",
|
||||
"label": "Address Type",
|
||||
"fieldtype": "Select",
|
||||
"options": [
|
||||
"Billing", "Shipping", "Office",
|
||||
"Personal", "Plant", "Postal",
|
||||
"Shop", "Subsidary", "Warehouse",
|
||||
"Current", "Permanent", "Other"
|
||||
]
|
||||
},
|
||||
{
|
||||
"fieldname": "addressLine1",
|
||||
"label": "Address Line 1",
|
||||
"fieldtype": "Data",
|
||||
"required": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "addressLine2",
|
||||
"label": "Address Line 2",
|
||||
"fieldtype": "Data"
|
||||
},
|
||||
{
|
||||
"fieldname": "city",
|
||||
"label": "City / Town",
|
||||
"fieldtype": "Data",
|
||||
"required": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "county",
|
||||
"label": "County",
|
||||
"fieldtype": "Data"
|
||||
},
|
||||
{
|
||||
"fieldname": "state",
|
||||
"label": "State",
|
||||
"fieldtype": "Data"
|
||||
},
|
||||
{
|
||||
"fieldname": "country",
|
||||
"label": "Country",
|
||||
"fieldtype": "Data",
|
||||
"required": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "postalCode",
|
||||
"label": "Postal Code",
|
||||
"fieldtype": "Data"
|
||||
},
|
||||
{
|
||||
"fieldname": "emailAddress",
|
||||
"label": "Email Address",
|
||||
"fieldtype": "Data"
|
||||
},
|
||||
{
|
||||
"fieldname": "phone",
|
||||
"label": "Phone",
|
||||
"fieldtype": "Data"
|
||||
},
|
||||
{
|
||||
"fieldname": "fax",
|
||||
"label": "Fax",
|
||||
"fieldtype": "Data"
|
||||
},
|
||||
{
|
||||
"fieldname": "isPreferredBilling",
|
||||
"label": "Preferred Billing Address",
|
||||
"fieldtype": "Check"
|
||||
},
|
||||
{
|
||||
"fieldname": "isShippingBilling",
|
||||
"label": "Preferred Shipping Address",
|
||||
"fieldtype": "Check"
|
||||
}
|
||||
],
|
||||
|
||||
events: {
|
||||
validate: (doc) => {
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
listSettings: {
|
||||
getFields(list) {
|
||||
return ['addressTitle', 'addressType'];
|
||||
},
|
||||
getRowHTML(list, data) {
|
||||
console.log(list, data);
|
||||
return `<div class="col-11">${list.getNameHTML(data)} (${data.addressType})</div>`;
|
||||
}
|
||||
},
|
||||
|
||||
layout: [
|
||||
// section 1
|
||||
{
|
||||
columns: [
|
||||
{
|
||||
fields: [ "addressTitle", "addressType", "addressLine1",
|
||||
"addressLine2", "city", "county", "state", "country",
|
||||
"postalCode"]
|
||||
},
|
||||
{ fields: [ "emailAddress", "phone", "fax", "isPreferredBilling", "isShippingBilling" ] }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
82
models/doctype/Contact/Contact.js
Normal file
82
models/doctype/Contact/Contact.js
Normal file
@ -0,0 +1,82 @@
|
||||
module.exports = {
|
||||
"name": "Contact",
|
||||
"doctype": "DocType",
|
||||
"isSingle": 0,
|
||||
"naming": "autoincrement",
|
||||
"pageSettings": {
|
||||
"hideTitle": true
|
||||
},
|
||||
"titleField": "fullName",
|
||||
"keywordFields": [
|
||||
"fullName"
|
||||
],
|
||||
"titleField": "fullName",
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "fullName",
|
||||
"label": "Full Name",
|
||||
"fieldtype": "Data",
|
||||
"required": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "emailAddress",
|
||||
"label": "Email Address",
|
||||
"fieldtype": "Data"
|
||||
},
|
||||
{
|
||||
"fieldname": "userId",
|
||||
"label": "User ID",
|
||||
"fieldtype": "Link",
|
||||
"target": "User",
|
||||
"hidden": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "status",
|
||||
"label": "Status",
|
||||
"fieldtype": "Select",
|
||||
"options": ["Passive", "Open", "Replied"]
|
||||
},
|
||||
{
|
||||
"fieldname": "gender",
|
||||
"label": "Gender",
|
||||
"fieldtype": "Select",
|
||||
"options": ["Male", "Female", "Gender"]
|
||||
},
|
||||
{
|
||||
"fieldname": "mobileNumber",
|
||||
"label": "Mobile Number",
|
||||
"fieldtype": "Data"
|
||||
},
|
||||
{
|
||||
"fieldname": "phone",
|
||||
"label": "Phone",
|
||||
"fieldtype": "Data"
|
||||
}
|
||||
],
|
||||
|
||||
events: {
|
||||
validate: (doc) => {
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
listSettings: {
|
||||
getFields(list) {
|
||||
return ['fullName'];
|
||||
},
|
||||
getRowHTML(list, data) {
|
||||
console.log(list, data);
|
||||
return `<div class="col-11">${list.getNameHTML(data)}</div>`;
|
||||
}
|
||||
},
|
||||
|
||||
layout: [
|
||||
// section 1
|
||||
{
|
||||
columns: [
|
||||
{ fields: [ "fullName", "emailAddress", "userId", "status" ] },
|
||||
{ fields: [ "postalCode", "gender", "phone", "mobileNumber" ] }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
const Invoice = require('./invoiceDocument');
|
||||
const Invoice = require('./InvoiceDocument');
|
||||
const frappe = require('frappejs');
|
||||
const LedgerPosting = require.main.require('./accounting/ledgerPosting');
|
||||
|
||||
|
@ -16,6 +16,8 @@ module.exports = {
|
||||
|
||||
Tax: require('./doctype/Tax/Tax.js'),
|
||||
TaxDetail: require('./doctype/TaxDetail/TaxDetail.js'),
|
||||
TaxSummary: require('./doctype/TaxSummary/TaxSummary.js')
|
||||
TaxSummary: require('./doctype/TaxSummary/TaxSummary.js'),
|
||||
Address: require('./doctype/Address/Address.js'),
|
||||
Contact: require('./doctype/Contact/Contact.js')
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user