From da08c59f3473d9fa4305036807d5d560bd63289a Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Tue, 27 Mar 2018 17:08:00 +0530 Subject: [PATCH] Address Model Added --- models/doctype/Address/Address.js | 120 ++++++++++++++++++++++++++++++ models/index.js | 3 +- 2 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 models/doctype/Address/Address.js diff --git a/models/doctype/Address/Address.js b/models/doctype/Address/Address.js new file mode 100644 index 00000000..15a1493b --- /dev/null +++ b/models/doctype/Address/Address.js @@ -0,0 +1,120 @@ +module.exports = { + "name": "Account", + "doctype": "DocType", + "isSingle": 0, + "keywordFields": [ + "name", + "addressType" + ], + "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 ['name', 'addressType']; + }, + getRowHTML(list, data) { + return `
${list.getNameHTML(data)} (${data.addressType})
`; + } + }, + + layout: [ + // section 1 + { + columns: [ + { + fields: [ "addressTitle", "addressType", "addressLine1", + "addressLine2", "city", "county", "state", "country", + "postalCode"] + }, + { fields: [ "emailAddress", "phone", "fax", "isPreferredBilling", "isShippingBilling" ] } + ] + } + ] +} \ No newline at end of file diff --git a/models/index.js b/models/index.js index 7efaa682..c328be21 100644 --- a/models/index.js +++ b/models/index.js @@ -11,6 +11,7 @@ module.exports = { InvoiceSettings: require('./doctype/InvoiceSettings/InvoiceSettings.js'), 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') } }