From f636503dc1e124f686a16eeade69e26b18c26470 Mon Sep 17 00:00:00 2001 From: Shreya Date: Tue, 15 May 2018 15:57:27 +0530 Subject: [PATCH 1/2] [minor] Fix customer doctype --- erpnext/selling/doctype/customer/customer.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js index ed8e6c8f5f..a253380686 100644 --- a/erpnext/selling/doctype/customer/customer.js +++ b/erpnext/selling/doctype/customer/customer.js @@ -58,6 +58,17 @@ frappe.ui.form.on("Customer", { frm.set_value("primary_address", ""); } }, + + is_internal_customer: function(frm) { + frm.set_value("represents_company", ""); + if (frm.doc.is_internal_customer == 1) { + frm.toggle_reqd("represents_company", true); + } + else { + frm.toggle_reqd("represents_company", false); + } + }, + customer_primary_contact: function(frm){ if(!frm.doc.customer_primary_contact){ frm.set_value("mobile_no", ""); From 8e386167b8b4e78b66f5474d155744c295677942 Mon Sep 17 00:00:00 2001 From: Shreya Date: Tue, 15 May 2018 15:58:41 +0530 Subject: [PATCH 2/2] Set Mandatory from client-side --- erpnext/selling/doctype/customer/customer.js | 8 ++++---- erpnext/selling/doctype/customer/customer.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js index a253380686..88e66ca668 100644 --- a/erpnext/selling/doctype/customer/customer.js +++ b/erpnext/selling/doctype/customer/customer.js @@ -5,7 +5,6 @@ frappe.ui.form.on("Customer", { setup: function(frm) { frm.add_fetch('lead_name', 'company_name', 'customer_name'); frm.add_fetch('default_sales_partner','commission_rate','default_commission_rate'); - frm.set_query('customer_group', {'is_group': 0}); frm.set_query('default_price_list', { 'selling': 1}); frm.set_query('account', 'accounts', function(doc, cdt, cdn) { @@ -19,12 +18,15 @@ frappe.ui.form.on("Customer", { if(doc.party_account_currency) { $.extend(filters, {"account_currency": doc.party_account_currency}); } - return { filters: filters } }); + if (frm.doc.__islocal == 1) { + frm.set_value("represents_company", ""); + } + frm.set_query('customer_primary_contact', function(doc) { return { query: "erpnext.selling.doctype.customer.customer.get_customer_primary_contact", @@ -60,7 +62,6 @@ frappe.ui.form.on("Customer", { }, is_internal_customer: function(frm) { - frm.set_value("represents_company", ""); if (frm.doc.is_internal_customer == 1) { frm.toggle_reqd("represents_company", true); } @@ -84,7 +85,6 @@ frappe.ui.form.on("Customer", { } frappe.dynamic_link = {doc: frm.doc, fieldname: 'name', doctype: 'Customer'} - frm.toggle_display(['address_html','contact_html','primary_address_and_contact_detail'], !frm.doc.__islocal); if(!frm.doc.__islocal) { diff --git a/erpnext/selling/doctype/customer/customer.json b/erpnext/selling/doctype/customer/customer.json index e38f6b3e02..881a6a5dbc 100644 --- a/erpnext/selling/doctype/customer/customer.json +++ b/erpnext/selling/doctype/customer/customer.json @@ -493,7 +493,7 @@ "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, - "reqd": 1, + "reqd": 0, "search_index": 0, "set_only_once": 0, "translatable": 0, @@ -1625,7 +1625,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-04-19 12:19:35.311509", + "modified": "2018-05-15 15:58:22.255321", "modified_by": "Administrator", "module": "Selling", "name": "Customer",