Set Mandatory from client-side

This commit is contained in:
Shreya
2018-05-15 15:58:41 +05:30
parent f636503dc1
commit 8e386167b8
2 changed files with 6 additions and 6 deletions

View File

@@ -5,7 +5,6 @@ frappe.ui.form.on("Customer", {
setup: function(frm) { setup: function(frm) {
frm.add_fetch('lead_name', 'company_name', 'customer_name'); frm.add_fetch('lead_name', 'company_name', 'customer_name');
frm.add_fetch('default_sales_partner','commission_rate','default_commission_rate'); frm.add_fetch('default_sales_partner','commission_rate','default_commission_rate');
frm.set_query('customer_group', {'is_group': 0}); frm.set_query('customer_group', {'is_group': 0});
frm.set_query('default_price_list', { 'selling': 1}); frm.set_query('default_price_list', { 'selling': 1});
frm.set_query('account', 'accounts', function(doc, cdt, cdn) { frm.set_query('account', 'accounts', function(doc, cdt, cdn) {
@@ -19,12 +18,15 @@ frappe.ui.form.on("Customer", {
if(doc.party_account_currency) { if(doc.party_account_currency) {
$.extend(filters, {"account_currency": doc.party_account_currency}); $.extend(filters, {"account_currency": doc.party_account_currency});
} }
return { return {
filters: filters filters: filters
} }
}); });
if (frm.doc.__islocal == 1) {
frm.set_value("represents_company", "");
}
frm.set_query('customer_primary_contact', function(doc) { frm.set_query('customer_primary_contact', function(doc) {
return { return {
query: "erpnext.selling.doctype.customer.customer.get_customer_primary_contact", query: "erpnext.selling.doctype.customer.customer.get_customer_primary_contact",
@@ -60,7 +62,6 @@ frappe.ui.form.on("Customer", {
}, },
is_internal_customer: function(frm) { is_internal_customer: function(frm) {
frm.set_value("represents_company", "");
if (frm.doc.is_internal_customer == 1) { if (frm.doc.is_internal_customer == 1) {
frm.toggle_reqd("represents_company", true); 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'} 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); frm.toggle_display(['address_html','contact_html','primary_address_and_contact_detail'], !frm.doc.__islocal);
if(!frm.doc.__islocal) { if(!frm.doc.__islocal) {

View File

@@ -493,7 +493,7 @@
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0, "remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 1, "reqd": 0,
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"translatable": 0, "translatable": 0,
@@ -1625,7 +1625,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2018-04-19 12:19:35.311509", "modified": "2018-05-15 15:58:22.255321",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Selling", "module": "Selling",
"name": "Customer", "name": "Customer",