Change the status of Form when it is newly created and saved

I have a custom doctype “Quality Update”

i want when i simply save the form the status which is in draft changes to “Quality Pending”

Tried below codes but didn’t work (all are working when i submit), i know it is possible

class QualityUpdate(Document):
    def before_validate(self):
        self.status = "Quality Pending"

frappe.listview_settings['Quality Update'] = {
    // Customize the visual indicator based on the status
    get_indicator: function (doc) {
        if (["Quality Pending", "In-process"].includes(doc.status)) {
            return [(doc.status), "orange", "status,=," + doc.status];
        } else if (doc.status === "Draft") {
            return ["Draft", "blue", "status,=,Draft"];
        } else if (doc.status === "Pass") {
            return ["Pass", "green", "status,=,Pass"];
        } else if (doc.status === "Rejected") {
            return ["Rejected", "red", "status,=,Rejected"];
        }
    }
};

many other also like, validate, before_save, before_submit etc, but didn’t work
anyone please help?

Use the Server Script doctype
Trigger: before_insert

doc.status = "Quality Pending"

Alternatively,
If there is no use of ‘Draft’, remove it from the status options or replace it with ‘Quality Pending’

Alternatively,
You can set Quality Pending as the default value for status field

Alternatively,
You can use workflows

@Rajat96318 add this
has_indicator_for_draft:true;

2 Likes

thank you man, it works :slight_smile: