@goldenscrew . open customization → customize form and enter your doctype . then add as more fields as you need .
for the data itself , you need to write a script that does the checking and changes the field if necessary
@goldenscrew. Add ,(dont edit ) a new row in the Course schedule customization . the type better be (select) , the name is your choice. check “in list view”. button the options can be (Yes,No), one in each line. Default must be (No). also check the “read only” button.
this is the first part . do it and come back to me
@goldenscrew you havn’t set default to No . anyways for the script I recomand a server script .
create a new server script. set a name , the reference is Student Attendance. event (after submit ). script try teh bellow:
cs = frappe.get_doc("Course Schedule",doc.course_schedule)
if cs.attendance !="Yes":
next . add any new student attendance , when you submit it . open the list and check if attendance in that course schedule changed to Yes .
@goldenscrew, you’re welcome . now when you understood how it works , you can change the select type to int or even data . and instead of yes and no you can write numbers or anything else .
here are some script documentations that may help you: Document api Database API
Please allow me to compliment you the way you have helped @goldenscrew. This is what an open-source community is all about.
(1) He did stuff himself…
(2) you helped him with some stuff
(3) you gave him the tools so he can take it further
I don’t know what @goldenscrew has in terms of experience, but if I can just reflect on my own
frustration when it comes to customization within ERPNext. I have written lots of
C-code which is a different style of coding. So it requires one to change the way you
approach ERPNext-code. So it makes the first few steps one takes to write your own code in
ERPNext a bit more challenging. Its almost like one needs to get over an initial hill first to overcome that mindset that one is used to
I really think that the DEVs have done a good job when they developed the use-cases but
there are places that one wants to modify … like in this case.
I have also seen things that I want changed and I am also battling. And if those of us that
are not so comfortable about writting code is assisted in the way you have just now, then
later on we can also assist others.
notice that I wrote the name of course schedule manually.
all the methods in the 2 docs I mentioned before will work here),you can also edit docs with doc.save() but they will not be committed unless you commit them using frappe.db.commit()
also , the console is a python ide, so you can also write python code like for loops and stuff.
to see a all doctypes fields , there are many ways .
easiest way : open doctype list → set doctype → fields are in the table (use names not Labels)