diff --git a/frappe/patches.txt b/frappe/patches.txt index d57b103aad..de06c712d3 100644 --- a/frappe/patches.txt +++ b/frappe/patches.txt @@ -201,4 +201,5 @@ frappe.patches.v9_1.revert_domain_settings frappe.patches.v9_1.move_feed_to_activity_log execute:frappe.delete_doc('Page', 'data-import-tool', ignore_missing=True) frappe.patches.v10_0.reload_countries_and_currencies -frappe.patches.v10_0.increase_single_table_column_length \ No newline at end of file +frappe.patches.v10_0.set_no_copy_to_workflow_state +frappe.patches.v10_0.increase_single_table_column_length diff --git a/frappe/patches/v10_0/set_no_copy_to_workflow_state.py b/frappe/patches/v10_0/set_no_copy_to_workflow_state.py new file mode 100644 index 0000000000..00ca125bf7 --- /dev/null +++ b/frappe/patches/v10_0/set_no_copy_to_workflow_state.py @@ -0,0 +1,11 @@ +import frappe + +def execute(): + for dt in frappe.get_all("Workflow", fields=['name', 'document_type', 'workflow_state_field']): + fieldname = frappe.db.get_value("Custom Field", filters={'dt': dt.document_type, + 'fieldname': dt.workflow_state_field}) + + if fieldname: + custom_field = frappe.get_doc("Custom Field", fieldname) + custom_field.no_copy = 1 + custom_field.save() diff --git a/frappe/workflow/doctype/workflow/workflow.py b/frappe/workflow/doctype/workflow/workflow.py index 9de175c168..b1b22925ba 100644 --- a/frappe/workflow/doctype/workflow/workflow.py +++ b/frappe/workflow/doctype/workflow/workflow.py @@ -31,6 +31,7 @@ class Workflow(Document): "label": self.workflow_state_field.replace("_", " ").title(), "hidden": 1, "allow_on_submit": 1, + "no_copy": 1, "fieldtype": "Link", "options": "Workflow State", }).save()