Like a JS event trigger ("onload", "validate" etc)? Those guys? This is (intended to be) python, I have no idea if it’ll run on the client side. Can you share your error? I’ve never had to pass before_insert a trigger before, but something may have changed.
I am trying to make a customized naming series that uses a select field as part of the naming series for the document. My initial step towards even getting a simple custom defined naming series have not worked.
I followed this post and this one regarding customized naming and have come up empty on even getting the first step of getting the hooks and python file to set a field value. Some of my initial problems were related to having the “custom” button checked in the Doctype editor. That seemed to make the Doctype ignore the python file altogether.
My hooks.py file calls my Doctype “Document” in the document events section of the hooks file:
Thank you for that reference code. I went line by line through the RestaurantTable.py code, the Doctype layouts, Doctype setups and confirmed that it works as intended. There is something in my custom app that seems to be preventing the autoname function from working. I am going to create a new droplet and see if autoname works in a fresh app environment and start tracing the problem from the ground up.
If you’re in developer mode it should pick the changes right up. It you’re in production mode, bench restart should work (but you should reconsider your dev workflow if you’re developing in production mode).
Eureka! Thank you @tmatteson. I owe you a case of New Hampshire’s finest brew. I was reloading the site in production mode instead of restarting the bench. Hard lesson learned but hopefully someone else will benefit from my wasted weekend struggling with this problem. Everything works even better than I had hoped since the autoname function tracks the numeric sequence for all my unique prefixes.