I’ve done some custom code to create a bank entry from the expense claim but it doesn’t seem to be working and there’s no error in the console. Could someone please have a look and suggest where I might need to make changes?
Don’t add code to the ERPNext module directly. This will mean you can’t run updates on ERPNext ever. Instead, create your own app and add the code in there.
Adding debugger; or console.log('message'); code in your js code will make it a lot easier to see what’s going on (is the code getting called at all, what are the values, etc)
You probably want to pass frm into your function for make_advance_entry.
It doesn’t look like you save the je. I think you’ll need a je.save() at the end.
Could you please suggest exactly how to pass frm in the code? I’m following the reference of the make_bank_entry code in ERPNext and I’m not sure that was included
What would call make_advance_entry? Do you have a button with that label added as a custom field? You could also use a frm.add_custom_button() to call it. There are good examples in the core code for this.
I expect this part of the code to call the make_advance_entry function but it doesn’t seem to be doing so. I also tried replacing it with this.make_advance_entry but it’s still the same
Trust you’re doing great. I eventually got the script to work but I need help with one more thing. I have a custom field on the Expense Claim form and would like to add a validation to the custom button so that an error message is returned to the user if they click the button and the custom field is blank. Any idea how to achieve this?