From dfd364dc95255f2ebfb018544cab5de3b69278b6 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Wed, 20 Nov 2019 00:45:42 +0530 Subject: [PATCH] fix: Add email, phone, address fields to Party --- models/doctype/Party/Party.js | 67 +++++++++++++++++++++++++---------- 1 file changed, 49 insertions(+), 18 deletions(-) diff --git a/models/doctype/Party/Party.js b/models/doctype/Party/Party.js index 6aa848b8..e6128ed3 100644 --- a/models/doctype/Party/Party.js +++ b/models/doctype/Party/Party.js @@ -1,3 +1,5 @@ +let { _ } = require('frappejs/utils'); + module.exports = { name: 'Party', label: 'Party', @@ -17,6 +19,16 @@ module.exports = { label: 'Image', fieldtype: 'AttachImage', }, + { + fieldname: 'customer', + label: 'Customer', + fieldtype: 'Check' + }, + { + fieldname: 'supplier', + label: 'Supplier', + fieldtype: 'Check' + }, { fieldname: 'defaultAccount', label: 'Default Account', @@ -29,33 +41,52 @@ module.exports = { }; } }, + { + fieldname: 'outstandingAmount', + label: 'Outstanding Amount', + fieldtype: 'Currency' + }, { fieldname: 'currency', label: 'Currency', fieldtype: 'Link', target: 'Currency', - formula: async doc => { - const { currency } = await frappe.getSingle('AccountingSettings'); - return currency; + placeholder: 'INR' + }, + { + fieldname: 'email', + label: 'Email', + fieldtype: 'Data', + placeholder: 'john@doe.com' + }, + { + fieldname: 'phone', + label: 'Phone', + fieldtype: 'Data', + placeholder: 'Phone' + }, + { + fieldname: 'address', + label: 'Address', + fieldtype: 'Link', + target: 'Address', + placeholder: _('Click to create'), + inline: true + }, + { + fieldname: 'addressDisplay', + label: 'Address Display', + fieldtype: 'Text', + readOnly: true, + formula: doc => { + if (doc.address) { + return doc.getFrom('Address', doc.address, 'addressDisplay'); + } } - }, - { - fieldname: 'customer', - label: 'Customer', - fieldtype: 'Check' - }, - { - fieldname: 'supplier', - label: 'Supplier', - fieldtype: 'Check' } ], - quickEditFields: [ - 'address', - 'defaultAccount', - 'currency' - ], + quickEditFields: ['defaultAccount', 'currency', 'email', 'phone', 'address'], getFormTitle(doc) { if (doc.customer) return 'Customer';