Changing Employee Status

Hi there,
I have created a custom doctype Disciplinary Action.
In that i have an option of Termination as soon as the Authorized person clicks on the termination button the employee status must change to Left from Active
How can i implement this?

Hi ! I think you have to apply workflow

Hi there can you please ellaborate it?

Hello the link that I gave you is fully documented, please refer there. thanks!

Disciplinary Action is one Doctype and Employee is another Doctype how can i change the status of employee by clicking on a button on Disciplinary Action Doctype?
By workflow we can change the state on employee but it cant be based on Disciplinary action.

write a script on button trigger and using change status of employee using python code

frappe.db.set_value("Doctype", "docname", "field", "value")


frappe.db.set_value("Employee", "name_of_doc", "status", "Left")

I am getting an error…
My JS Script:

frappe.ui.form.on(‘Disciplinary Action’, {
reject: function(frm) {
if (!frm.doc.__islocal) {
alert(“Are you sure you want to terminate the employee?”);{
            method: "",
            callback: function(r){
                if (r.message) {
                    frappe.msgprint("Employee has been terminated.");
                else {
                    frappe.throw("Unable to Terminate.");
        else {
            frappe.throw(("Save the Document first."));


My Python Script:

class DisciplinaryAction(Document):

def terminate(employee):
     frappe.db.set_value("Employee", employee, "status", "Left")

The error is:


check your method path. seems like you entered wrong.

The method path is correct sir.


paste below line in your python script

from frappe.model.document import Document

It is already present.

under which module Disciplinary Action is present ?
have you return anything from py method ?

Disciplinary module is under HR Module.
No nothing has been returned.

Any Update on this?


make sure your python method is written under class DisciplinaryAction(Document).
I think you wrote it outside. Please check.

I am attaching the image for you to get a clear idea…

js script image:

Py script image:


No Idea why this happening.
One more thing return something from a py side. Because you capturing response

@Ujjawal Hi
In Python file you have written whitelisted method inside the class.
Please write it outside the class

It raises an error expected indented block if whitelist is done outside the class.

write pass inside class