diff --git a/frappe/workflow/doctype/workflow/workflow.py b/frappe/workflow/doctype/workflow/workflow.py index 9593526832..5376c675d1 100644 --- a/frappe/workflow/doctype/workflow/workflow.py +++ b/frappe/workflow/doctype/workflow/workflow.py @@ -33,12 +33,14 @@ class Workflow(Document): def validate(self): self.set_active() - self.create_custom_field_for_workflow_state() - self.update_default_workflow_status() self.validate_docstatus() + def after_insert(self): + self.create_custom_field_for_workflow_state() + def on_update(self): frappe.clear_cache(doctype=self.document_type) + self.update_default_workflow_status() def create_custom_field_for_workflow_state(self): frappe.clear_cache(doctype=self.document_type)