Doctype controller code isn't executing

Hi, new developer here, following the tutorial (roughly). Could someone please point me in the right direction?

I created a new app via bench, added it to the site, and added a doctype. So far that works fine. I can verify the new doctype’s values are in the DB.

But when I modify the doctype’s controller’s python code (just a simple message on the controller’s validate function), it’s not being executed. I don’t see anything in any logs (server or browser).

class MyDocType(Document):
    def validate(self):

What did you have modified? Also, you have to save the form to trigger validate function.

I followed the Frappe tutorial and: created/enabled an app, created a doctype, then modified the controller.

In this case I modified the boilerplate controller doctype/library_transaction/ and added a call to msgprint() to see if validate() was being called when I hit Save. It wasn’t called. I tried this again with another newly created test app and doctype with the same results. Yet if I put that same msgprint in a validate function in a controller for a doctype that I didn’t create (i.e.: doctype/user/user/py), it is being called when I hit Save.

So I’m guessing I’m missing something to enable use of the controller. I checked unix permissions, even tried bench migrate which appeared to force the to compile to a pyc file, but it had no affect on the results.

edit: Here’s the actual modified controller code for the doctype. Note, the doctype itself works from the GUI (even some client-side js that I modified), just not the python controller code. No error, it’s just being ignored.

from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document

class LibraryTransaction(Document):

        def validate(self):

I think I might’ve solved it. I restarted the server with:

sudo supervisorctl restart frappe-bench-workers: frappe-bench-web:

and now the controller code is being used. It’s confusing since I’m fairly certain I made some test changes to the existing Doctype controller and it was active immediately without a restart. I could be mistaken though.

Can someone confirm that this is the proper dev workflow, that the server needs to be restarted after a change? If so, is it mentioned in the documentation? I’ll volunteer to make the change if it’s not, I could use the practice contributing back to the community :slight_smile: