Try ERPNext Buy Support Partners Foundation Foundation Members

Customer Doctype

I have two issues in customer doctype :

  1. how can i keep customer group field blank by default while adding new customer
  2. want to hide ‘Disable’ field

i think this isnt possible. even if you remove the mandatory of this field with customscript, the validate function will throw an error because of missing field…

therefore you can go to customise and set this checkbbox to hidden

2 Likes

Thanks @joelios

1 Like

Please help me with this

  1. how can i keep customer group field blank by default while adding new customer

My lead is telling this can be done.Please help. I am new to ERP.

But before you save the new customer, you will add a customer group?

What about customer group name and parent customer group? Can any changes be made in this to solve the issue??

There are 3 posibillities;

  1. customize doctype customer and remove mandatory frim customer_group. —> this doesnt work because erpnext dont allow you to change mandatory of standard fields (you cant save the customizings)
  2. set customer_group to „“ with customscript (cur_frm.set_value(‘field_name’, ‘value’); )
  3. remove mandatory of customer_group with customscript (cur_frm.set_df_property(‘field_name’,‘properity’,‘value’); )

2&3 work as customscript, but when you want to save the new customer without a customer_group, the validation function will not work.

Conclusion; you have to set a customer_group.

2 Likes

@Ashutosh_Halape Are you going to add value to customer group field later? I assume you want that if the default ‘All Customer Groups’ and ‘All Territories’ value is selected the document is not saved. If that is so follow the below instructions:

Go to Customize Form
Select Customer in Enter Form Type
Uncheck the field Quick Entry
Go to Custom Script
Select Customer in Doctype

paste the following code, refresh the customer page and you are good to go.

frappe.ui.form.on('Customer', {
	validate(frm) {
	    var doc = cur_frm.doc;
	    console.log('validated');
		if (doc.customer_group=='All Customer Groups'){
            frappe.throw('Please select a customer group other than All Customer Groups');
	    }
	    if (doc.territory=='All Territories'){
            frappe.throw('Please select a territory other than All Territories');
	    }
	}
})
1 Like

Thanks @joelios it’ll try

Thanks @Mohammad_Ahmad_Zulfi

But remember, you can not save a customer without entering any customer group!

1 Like

ok i’ll see to it

@joelios i have one more problem.It shows customer group = All customer group in quick edit but after clicking on edit full page it shows customer group value as blank by default.how do i show customer group value as blank by default in quick edit .Please help

as far as I know, this is not solvable with a customscript. you have to deactivate the quickentry.

Solved. I made changes in the selling settings.kept default customer group blank.Save and then reload.

2 Likes