Hi,
I have the following script, it can fetch the default login ID and update as Sales Person.
//11 AUTO FETCH SALES PERSON BASED ON LOGIN ID
frappe.ui.form.on(“Sales Invoice”, {
refresh: function(frm) {
if ( frm.doc.__islocal )
{
frm.doc.sales_team =var child = frm.add_child(‘sales_team’)
child.sales_person = frappe.user_info().fullname
child.allocated_percentage = “100”
frm.refresh_field(‘sales_team’)
}
else
{
child.sales_person = child.sales_person
child.allocated_percentage = child.allocated_percentage
}
},
customer: function(frm) {
if ( frm.doc.__islocal )
{
frm.doc.sales_team =var child = frm.add_child(‘sales_team’)
child.sales_person = frappe.user_info().fullname
child.allocated_percentage = “100”
frm.refresh_field(‘sales_team’)}
else
{
child.sales_person = child.sales_person
child.allocated_percentage = child.allocated_percentage
}
}});
However, this script seems crashed with the core file, and cause the “Make Invoice” button dissapeared. Kindly help to advise.
