Not understand how to use custom app

Hi everyone,
i have a custom app called ‘ict’, i defined a new module ‘ICT’ and new doctype ‘outcome’.
I’m in developers_mode 1, the doctype is make from web interface.
The problem is under ict/ict/ict/doctype/outcome the js part (outcome.js) work fine but i don’t understand how to use outcome.py

I create this file:

class Outcome(Document):
    def validate(self):
        frappe.throw("Hello")

this not work and i don’t understand

Thanks for your time

‘.py’ file is used to write your business logic. The validate method(trigger) that you have written is called when you create a new record under that doctype and save it.

1 Like

First of all thanks for the answer, now I try to explain myself better.
My goal is to create my logic inside the .py file, but seams that it was not read. The .js files are automatically taken from, the python one no. That code was just a test to verify that it was used, but when I click save on the doctype outcome I don’t see anything.
What could be the problem?

Your code should throw error “Hello”.
Did you create your file .py manually?

Files should be created after you create Doctype without custom checked.

Nothing comes out, yes I created it manually, I also read that it had to be created automatically, but I did not do it, but the custom is checked.
I try to remove it and see what happens, I didn’t know this thing.
Thanks a lot!

Custom tick comes checked by default if your developer mode isn’t enabled.
First enable your developer mode,

  1. Go to frappe-bench/sites/your_site folder
  2. Open site_config.json
  3. Append, “developer_mode”: 1 in the json file
  4. Stop your setup and hit the command ‘bench migrate && bench clear-cache && bench build’
  5. After the execution of that command, start your setup and go for doctype creation.

Now you can remove the custom tick and save your doctype.
The folder and files will be created automatically. Then you can proceed further.