How to auto-select option depended on previous field?

Hi Team,

How to select any option in Select field from previous selection field.

e.g We have two naming series for Payment Entry, PE & RE.
Is there any option to select particular naming series PE when we select Payment and RE when we select Receive?

Thanks

hi,

look at the example in employee, when you select the salutation it sets the gender.

salutation: function() {
	if(this.frm.doc.salutation) {
		this.frm.set_value("gender", {
			"Mr": "Male",
			"Ms": "Female"
		}[this.frm.doc.salutation]);
	}
},

Thanks for your revert, but can I do something using customization. I don’t want to enter in Developer mode.

hi
i was have this situation , i have 3 naming series for payment entry , and i want applying automatically each one for transaction entry (Receive, Pay, Internal Transfer) , so i made this script :

 frappe.ui.form.on("Payment Entry", "payment_type", function(frm) {
  
  if(frm.doc.payment_type == "Receive")
  {
    set_field_options("naming_series", ["ACC-REC-"])
    cur_frm.set_value("naming_series", "ACC-REC-")
  }
  else  if(frm.doc.payment_type == "Pay")
  {
    set_field_options("naming_series", ["ACC-PAY-"])
    cur_frm.set_value("naming_series", "ACC-PAY-")
  }
  else  if(frm.doc.payment_type == "Internal Transfer")
  {
    set_field_options("naming_series", ["ACC-TRA-"])
    cur_frm.set_value("naming_series", "ACC-TRA-")
  }
  });

I hope this will be helpful

2 Likes