Merge pull request #14046 from shreyashah115/min-fix

[Minor] Fixes for Customer DocType
This commit is contained in:
rohitwaghchaure 2018-05-15 16:30:46 +05:30 committed by GitHub
commit 9a0aea8abc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 5 deletions

View File

@ -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",
@ -58,6 +60,16 @@ frappe.ui.form.on("Customer", {
frm.set_value("primary_address", "");
}
},
is_internal_customer: function(frm) {
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", "");
@ -73,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) {

View File

@ -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",