diff --git a/.github/helper/documentation.py b/.github/helper/documentation.py
index f8ee3fa10b..aece5f543b 100644
--- a/.github/helper/documentation.py
+++ b/.github/helper/documentation.py
@@ -24,6 +24,8 @@ def docs_link_exists(body):
parts = parsed_url.path.split('/')
if len(parts) == 5 and parts[1] == "frappe" and parts[2] in docs_repos:
return True
+ if parsed_url.netloc in ["docs.erpnext.com", "frappeframework.com"]:
+ return True
if __name__ == "__main__":
diff --git a/frappe/core/doctype/doctype/doctype.json b/frappe/core/doctype/doctype/doctype.json
index e18edc1512..03e3b65ea1 100644
--- a/frappe/core/doctype/doctype/doctype.json
+++ b/frappe/core/doctype/doctype/doctype.json
@@ -1,686 +1,700 @@
{
- "actions": [],
- "allow_rename": 1,
- "autoname": "Prompt",
- "creation": "2013-02-18 13:36:19",
- "description": "DocType is a Table / Form in the application.",
- "doctype": "DocType",
- "document_type": "Document",
- "engine": "InnoDB",
- "field_order": [
- "sb0",
- "module",
- "is_submittable",
- "istable",
- "issingle",
- "is_tree",
- "editable_grid",
- "quick_entry",
- "cb01",
- "track_changes",
- "track_seen",
- "track_views",
- "custom",
- "beta",
- "is_virtual",
- "fields_section_break",
- "fields",
- "sb1",
- "naming_rule",
- "autoname",
- "name_case",
- "allow_rename",
- "column_break_15",
- "description",
- "documentation",
- "form_settings_section",
- "image_field",
- "timeline_field",
- "nsm_parent_field",
- "max_attachments",
- "column_break_23",
- "hide_toolbar",
- "allow_copy",
- "allow_import",
- "allow_events_in_timeline",
- "allow_auto_repeat",
- "view_settings",
- "title_field",
- "search_fields",
- "default_print_format",
- "sort_field",
- "sort_order",
- "column_break_29",
- "document_type",
- "icon",
- "color",
- "show_preview_popup",
- "show_name_in_global_search",
- "email_settings_sb",
- "default_email_template",
- "column_break_51",
- "email_append_to",
- "sender_field",
- "subject_field",
- "sb2",
- "permissions",
- "restrict_to_domain",
- "read_only",
- "in_create",
- "actions_section",
- "actions",
- "links_section",
- "links",
- "web_view",
- "has_web_view",
- "allow_guest_to_view",
- "index_web_pages_for_search",
- "route",
- "is_published_field",
- "website_search_field",
- "advanced",
- "engine",
- "migration_hash"
- ],
- "fields": [
- {
- "fieldname": "sb0",
- "fieldtype": "Section Break",
- "oldfieldtype": "Section Break"
- },
- {
- "fieldname": "module",
- "fieldtype": "Link",
- "in_list_view": 1,
- "in_standard_filter": 1,
- "label": "Module",
- "oldfieldname": "module",
- "oldfieldtype": "Link",
- "options": "Module Def",
- "reqd": 1,
- "search_index": 1
- },
- {
- "default": "0",
- "depends_on": "eval:!doc.istable",
- "description": "Once submitted, submittable documents cannot be changed. They can only be Cancelled and Amended.",
- "fieldname": "is_submittable",
- "fieldtype": "Check",
- "label": "Is Submittable"
- },
- {
- "default": "0",
- "description": "Child Tables are shown as a Grid in other DocTypes",
- "fieldname": "istable",
- "fieldtype": "Check",
- "in_standard_filter": 1,
- "label": "Is Child Table",
- "oldfieldname": "istable",
- "oldfieldtype": "Check"
- },
- {
- "default": "0",
- "depends_on": "eval:!doc.istable",
- "description": "Single Types have only one record no tables associated. Values are stored in tabSingles",
- "fieldname": "issingle",
- "fieldtype": "Check",
- "in_standard_filter": 1,
- "label": "Is Single",
- "oldfieldname": "issingle",
- "oldfieldtype": "Check",
- "set_only_once": 1
- },
- {
- "default": "1",
- "depends_on": "istable",
- "fieldname": "editable_grid",
- "fieldtype": "Check",
- "label": "Editable Grid"
- },
- {
- "default": "0",
- "depends_on": "eval:!doc.istable && !doc.issingle",
- "description": "Open a dialog with mandatory fields to create a new record quickly",
- "fieldname": "quick_entry",
- "fieldtype": "Check",
- "label": "Quick Entry"
- },
- {
- "fieldname": "cb01",
- "fieldtype": "Column Break"
- },
- {
- "default": "0",
- "depends_on": "eval:!doc.istable",
- "description": "If enabled, changes to the document are tracked and shown in timeline",
- "fieldname": "track_changes",
- "fieldtype": "Check",
- "label": "Track Changes"
- },
- {
- "default": "0",
- "depends_on": "eval:!doc.istable",
- "description": "If enabled, the document is marked as seen, the first time a user opens it",
- "fieldname": "track_seen",
- "fieldtype": "Check",
- "label": "Track Seen"
- },
- {
- "default": "0",
- "depends_on": "eval:!doc.istable",
- "description": "If enabled, document views are tracked, this can happen multiple times",
- "fieldname": "track_views",
- "fieldtype": "Check",
- "label": "Track Views"
- },
- {
- "default": "0",
- "fieldname": "custom",
- "fieldtype": "Check",
- "label": "Custom?"
- },
- {
- "default": "0",
- "fieldname": "beta",
- "fieldtype": "Check",
- "label": "Beta"
- },
- {
- "fieldname": "fields_section_break",
- "fieldtype": "Section Break",
- "label": "Fields",
- "oldfieldtype": "Section Break"
- },
- {
- "fieldname": "fields",
- "fieldtype": "Table",
- "label": "Fields",
- "oldfieldname": "fields",
- "oldfieldtype": "Table",
- "options": "DocField"
- },
- {
- "fieldname": "sb1",
- "fieldtype": "Section Break",
- "label": "Naming"
- },
- {
- "description": "Naming Options:\n
- field:[fieldname] - By Field
- naming_series: - By Naming Series (field called naming_series must be present
- Prompt - Prompt user for a name
- [series] - Series by prefix (separated by a dot); for example PRE.#####
\n- format:EXAMPLE-{MM}morewords{fieldname1}-{fieldname2}-{#####} - Replace all braced words (fieldnames, date words (DD, MM, YY), series) with their value. Outside braces, any characters can be used.
",
- "fieldname": "autoname",
- "fieldtype": "Data",
- "label": "Auto Name",
- "oldfieldname": "autoname",
- "oldfieldtype": "Data"
- },
- {
- "fieldname": "name_case",
- "fieldtype": "Select",
- "label": "Name Case",
- "oldfieldname": "name_case",
- "oldfieldtype": "Select",
- "options": "\nTitle Case\nUPPER CASE"
- },
- {
- "fieldname": "column_break_15",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "description",
- "fieldtype": "Small Text",
- "label": "Description",
- "oldfieldname": "description",
- "oldfieldtype": "Text"
- },
- {
- "collapsible": 1,
- "fieldname": "form_settings_section",
- "fieldtype": "Section Break",
- "label": "Form Settings"
- },
- {
- "description": "Must be of type \"Attach Image\"",
- "fieldname": "image_field",
- "fieldtype": "Data",
- "label": "Image Field"
- },
- {
- "depends_on": "eval:!doc.istable",
- "description": "Comments and Communications will be associated with this linked document",
- "fieldname": "timeline_field",
- "fieldtype": "Data",
- "label": "Timeline Field"
- },
- {
- "fieldname": "max_attachments",
- "fieldtype": "Int",
- "label": "Max Attachments",
- "oldfieldname": "max_attachments",
- "oldfieldtype": "Int"
- },
- {
- "fieldname": "column_break_23",
- "fieldtype": "Column Break"
- },
- {
- "default": "0",
- "fieldname": "hide_toolbar",
- "fieldtype": "Check",
- "label": "Hide Sidebar and Menu",
- "oldfieldname": "hide_toolbar",
- "oldfieldtype": "Check"
- },
- {
- "default": "0",
- "fieldname": "allow_copy",
- "fieldtype": "Check",
- "label": "Hide Copy",
- "oldfieldname": "allow_copy",
- "oldfieldtype": "Check"
- },
- {
- "default": "1",
- "fieldname": "allow_rename",
- "fieldtype": "Check",
- "label": "Allow Rename",
- "oldfieldname": "allow_rename",
- "oldfieldtype": "Check"
- },
- {
- "default": "0",
- "fieldname": "allow_import",
- "fieldtype": "Check",
- "label": "Allow Import (via Data Import Tool)"
- },
- {
- "default": "0",
- "fieldname": "allow_events_in_timeline",
- "fieldtype": "Check",
- "label": "Allow events in timeline"
- },
- {
- "default": "0",
- "fieldname": "allow_auto_repeat",
- "fieldtype": "Check",
- "label": "Allow Auto Repeat"
- },
- {
- "collapsible": 1,
- "fieldname": "view_settings",
- "fieldtype": "Section Break",
- "label": "View Settings"
- },
- {
- "depends_on": "eval:!doc.istable",
- "fieldname": "title_field",
- "fieldtype": "Data",
- "label": "Title Field"
- },
- {
- "depends_on": "eval:!doc.istable",
- "fieldname": "search_fields",
- "fieldtype": "Data",
- "label": "Search Fields",
- "oldfieldname": "search_fields",
- "oldfieldtype": "Data"
- },
- {
- "fieldname": "default_print_format",
- "fieldtype": "Data",
- "label": "Default Print Format"
- },
- {
- "default": "modified",
- "depends_on": "eval:!doc.istable",
- "fieldname": "sort_field",
- "fieldtype": "Data",
- "label": "Default Sort Field"
- },
- {
- "default": "DESC",
- "depends_on": "eval:!doc.istable",
- "fieldname": "sort_order",
- "fieldtype": "Select",
- "label": "Default Sort Order",
- "options": "ASC\nDESC"
- },
- {
- "fieldname": "column_break_29",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "document_type",
- "fieldtype": "Select",
- "label": "Show in Module Section",
- "oldfieldname": "document_type",
- "oldfieldtype": "Select",
- "options": "\nDocument\nSetup\nSystem\nOther"
- },
- {
- "fieldname": "icon",
- "fieldtype": "Data",
- "label": "Icon"
- },
- {
- "fieldname": "color",
- "fieldtype": "Data",
- "label": "Color"
- },
- {
- "default": "0",
- "fieldname": "show_preview_popup",
- "fieldtype": "Check",
- "label": "Show Preview Popup"
- },
- {
- "default": "0",
- "fieldname": "show_name_in_global_search",
- "fieldtype": "Check",
- "label": "Make \"name\" searchable in Global Search"
- },
- {
- "depends_on": "eval:!doc.istable",
- "fieldname": "sb2",
- "fieldtype": "Section Break",
- "label": "Permission Rules"
- },
- {
- "fieldname": "permissions",
- "fieldtype": "Table",
- "label": "Permissions",
- "oldfieldname": "permissions",
- "oldfieldtype": "Table",
- "options": "DocPerm"
- },
- {
- "fieldname": "restrict_to_domain",
- "fieldtype": "Link",
- "label": "Restrict To Domain",
- "options": "Domain"
- },
- {
- "default": "0",
- "fieldname": "read_only",
- "fieldtype": "Check",
- "label": "User Cannot Search",
- "oldfieldname": "read_only",
- "oldfieldtype": "Check"
- },
- {
- "default": "0",
- "fieldname": "in_create",
- "fieldtype": "Check",
- "label": "User Cannot Create",
- "oldfieldname": "in_create",
- "oldfieldtype": "Check"
- },
- {
- "depends_on": "eval:doc.custom===0",
- "fieldname": "web_view",
- "fieldtype": "Section Break",
- "label": "Web View"
- },
- {
- "default": "0",
- "fieldname": "has_web_view",
- "fieldtype": "Check",
- "label": "Has Web View"
- },
- {
- "default": "0",
- "depends_on": "has_web_view",
- "fieldname": "allow_guest_to_view",
- "fieldtype": "Check",
- "label": "Allow Guest to View"
- },
- {
- "depends_on": "eval:!doc.istable",
- "fieldname": "route",
- "fieldtype": "Data",
- "label": "Route"
- },
- {
- "depends_on": "has_web_view",
- "fieldname": "is_published_field",
- "fieldtype": "Data",
- "label": "Is Published Field"
- },
- {
- "collapsible": 1,
- "fieldname": "advanced",
- "fieldtype": "Section Break",
- "hidden": 1,
- "label": "Advanced"
- },
- {
- "default": "InnoDB",
- "depends_on": "eval:!doc.issingle",
- "fieldname": "engine",
- "fieldtype": "Select",
- "label": "Database Engine",
- "options": "InnoDB\nMyISAM"
- },
- {
- "default": "0",
- "description": "Tree structures are implemented using Nested Set",
- "fieldname": "is_tree",
- "fieldtype": "Check",
- "label": "Is Tree"
- },
- {
- "depends_on": "is_tree",
- "fieldname": "nsm_parent_field",
- "fieldtype": "Data",
- "label": "Parent Field (Tree)"
- },
- {
- "description": "URL for documentation or help",
- "fieldname": "documentation",
- "fieldtype": "Data",
- "label": "Documentation Link"
- },
- {
- "collapsible": 1,
- "collapsible_depends_on": "actions",
- "fieldname": "actions_section",
- "fieldtype": "Section Break",
- "label": "Actions"
- },
- {
- "fieldname": "actions",
- "fieldtype": "Table",
- "label": "Actions",
- "options": "DocType Action"
- },
- {
- "collapsible": 1,
- "collapsible_depends_on": "links",
- "fieldname": "links_section",
- "fieldtype": "Section Break",
- "label": "Linked Documents"
- },
- {
- "fieldname": "links",
- "fieldtype": "Table",
- "label": "Links",
- "options": "DocType Link"
- },
- {
- "depends_on": "email_append_to",
- "fieldname": "subject_field",
- "fieldtype": "Data",
- "label": "Subject Field"
- },
- {
- "depends_on": "email_append_to",
- "fieldname": "sender_field",
- "fieldtype": "Data",
- "label": "Sender Field",
- "mandatory_depends_on": "email_append_to"
- },
- {
- "default": "0",
- "fieldname": "email_append_to",
- "fieldtype": "Check",
- "label": "Allow document creation via Email"
- },
- {
- "collapsible": 1,
- "fieldname": "email_settings_sb",
- "fieldtype": "Section Break",
- "label": "Email Settings"
- },
- {
- "default": "1",
- "fieldname": "index_web_pages_for_search",
- "fieldtype": "Check",
- "label": "Index Web Pages for Search"
- },
- {
- "default": "0",
- "fieldname": "is_virtual",
- "fieldtype": "Check",
- "label": "Is Virtual"
- },
- {
- "fieldname": "default_email_template",
- "fieldtype": "Link",
- "label": "Default Email Template",
- "options": "Email Template"
- },
- {
- "fieldname": "column_break_51",
- "fieldtype": "Column Break"
- },
- {
- "depends_on": "has_web_view",
- "fieldname": "website_search_field",
- "fieldtype": "Data",
- "label": "Website Search Field"
- },
- {
- "fieldname": "naming_rule",
- "fieldtype": "Select",
- "label": "Naming Rule",
- "length": 40,
- "options": "\nSet by user\nBy fieldname\nBy \"Naming Series\" field\nExpression\nExpression (old style)\nRandom\nBy script"
- },
- {
- "fieldname": "migration_hash",
- "fieldtype": "Data",
- "hidden": 1
- }
- ],
- "icon": "fa fa-bolt",
- "idx": 6,
- "links": [
- {
- "group": "Views",
- "link_doctype": "Report",
- "link_fieldname": "ref_doctype"
- },
- {
- "group": "Workflow",
- "link_doctype": "Workflow",
- "link_fieldname": "document_type"
- },
- {
- "group": "Workflow",
- "link_doctype": "Notification",
- "link_fieldname": "document_type"
- },
- {
- "group": "Customization",
- "link_doctype": "Custom Field",
- "link_fieldname": "dt"
- },
- {
- "group": "Customization",
- "link_doctype": "Client Script",
- "link_fieldname": "dt"
- },
- {
- "group": "Customization",
- "link_doctype": "Server Script",
- "link_fieldname": "reference_doctype"
- },
- {
- "group": "Workflow",
- "link_doctype": "Webhook",
- "link_fieldname": "webhook_doctype"
- },
- {
- "group": "Views",
- "link_doctype": "Print Format",
- "link_fieldname": "doc_type"
- },
- {
- "group": "Views",
- "link_doctype": "Web Form",
- "link_fieldname": "doc_type"
- },
- {
- "group": "Views",
- "link_doctype": "Calendar View",
- "link_fieldname": "reference_doctype"
- },
- {
- "group": "Views",
- "link_doctype": "Kanban Board",
- "link_fieldname": "reference_doctype"
- },
- {
- "group": "Workflow",
- "link_doctype": "Onboarding Step",
- "link_fieldname": "reference_document"
- },
- {
- "group": "Rules",
- "link_doctype": "Auto Repeat",
- "link_fieldname": "reference_doctype"
- },
- {
- "group": "Rules",
- "link_doctype": "Assignment Rule",
- "link_fieldname": "document_type"
- },
- {
- "group": "Rules",
- "link_doctype": "Energy Point Rule",
- "link_fieldname": "reference_doctype"
- }
- ],
- "modified": "2021-10-29 11:39:13.233403",
- "modified_by": "Administrator",
- "module": "Core",
- "name": "DocType",
- "owner": "Administrator",
- "permissions": [
- {
- "create": 1,
- "delete": 1,
- "email": 1,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "System Manager",
- "write": 1
- },
- {
- "create": 1,
- "delete": 1,
- "email": 1,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "Administrator",
- "share": 1,
- "write": 1
- }
- ],
- "route": "doctype",
- "search_fields": "module",
- "show_name_in_global_search": 1,
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 1
-}
+ "actions": [],
+ "allow_rename": 1,
+ "autoname": "Prompt",
+ "creation": "2013-02-18 13:36:19",
+ "description": "DocType is a Table / Form in the application.",
+ "doctype": "DocType",
+ "document_type": "Document",
+ "engine": "InnoDB",
+ "field_order": [
+ "sb0",
+ "module",
+ "is_submittable",
+ "istable",
+ "issingle",
+ "is_tree",
+ "editable_grid",
+ "quick_entry",
+ "cb01",
+ "track_changes",
+ "track_seen",
+ "track_views",
+ "custom",
+ "beta",
+ "is_virtual",
+ "fields_section_break",
+ "fields",
+ "sb1",
+ "naming_rule",
+ "autoname",
+ "name_case",
+ "allow_rename",
+ "column_break_15",
+ "description",
+ "documentation",
+ "form_settings_section",
+ "image_field",
+ "timeline_field",
+ "nsm_parent_field",
+ "max_attachments",
+ "column_break_23",
+ "hide_toolbar",
+ "allow_copy",
+ "allow_import",
+ "allow_events_in_timeline",
+ "allow_auto_repeat",
+ "view_settings",
+ "title_field",
+ "search_fields",
+ "default_print_format",
+ "sort_field",
+ "sort_order",
+ "column_break_29",
+ "document_type",
+ "icon",
+ "color",
+ "show_preview_popup",
+ "show_name_in_global_search",
+ "email_settings_sb",
+ "default_email_template",
+ "column_break_51",
+ "email_append_to",
+ "sender_field",
+ "subject_field",
+ "sb2",
+ "permissions",
+ "restrict_to_domain",
+ "read_only",
+ "in_create",
+ "actions_section",
+ "actions",
+ "links_section",
+ "links",
+ "document_states_section",
+ "states",
+ "web_view",
+ "has_web_view",
+ "allow_guest_to_view",
+ "index_web_pages_for_search",
+ "route",
+ "is_published_field",
+ "website_search_field",
+ "advanced",
+ "engine",
+ "migration_hash"
+ ],
+ "fields": [
+ {
+ "fieldname": "sb0",
+ "fieldtype": "Section Break",
+ "oldfieldtype": "Section Break"
+ },
+ {
+ "fieldname": "module",
+ "fieldtype": "Link",
+ "in_list_view": 1,
+ "in_standard_filter": 1,
+ "label": "Module",
+ "oldfieldname": "module",
+ "oldfieldtype": "Link",
+ "options": "Module Def",
+ "reqd": 1,
+ "search_index": 1
+ },
+ {
+ "default": "0",
+ "depends_on": "eval:!doc.istable",
+ "description": "Once submitted, submittable documents cannot be changed. They can only be Cancelled and Amended.",
+ "fieldname": "is_submittable",
+ "fieldtype": "Check",
+ "label": "Is Submittable"
+ },
+ {
+ "default": "0",
+ "description": "Child Tables are shown as a Grid in other DocTypes",
+ "fieldname": "istable",
+ "fieldtype": "Check",
+ "in_standard_filter": 1,
+ "label": "Is Child Table",
+ "oldfieldname": "istable",
+ "oldfieldtype": "Check"
+ },
+ {
+ "default": "0",
+ "depends_on": "eval:!doc.istable",
+ "description": "Single Types have only one record no tables associated. Values are stored in tabSingles",
+ "fieldname": "issingle",
+ "fieldtype": "Check",
+ "in_standard_filter": 1,
+ "label": "Is Single",
+ "oldfieldname": "issingle",
+ "oldfieldtype": "Check",
+ "set_only_once": 1
+ },
+ {
+ "default": "1",
+ "depends_on": "istable",
+ "fieldname": "editable_grid",
+ "fieldtype": "Check",
+ "label": "Editable Grid"
+ },
+ {
+ "default": "0",
+ "depends_on": "eval:!doc.istable && !doc.issingle",
+ "description": "Open a dialog with mandatory fields to create a new record quickly",
+ "fieldname": "quick_entry",
+ "fieldtype": "Check",
+ "label": "Quick Entry"
+ },
+ {
+ "fieldname": "cb01",
+ "fieldtype": "Column Break"
+ },
+ {
+ "default": "0",
+ "depends_on": "eval:!doc.istable",
+ "description": "If enabled, changes to the document are tracked and shown in timeline",
+ "fieldname": "track_changes",
+ "fieldtype": "Check",
+ "label": "Track Changes"
+ },
+ {
+ "default": "0",
+ "depends_on": "eval:!doc.istable",
+ "description": "If enabled, the document is marked as seen, the first time a user opens it",
+ "fieldname": "track_seen",
+ "fieldtype": "Check",
+ "label": "Track Seen"
+ },
+ {
+ "default": "0",
+ "depends_on": "eval:!doc.istable",
+ "description": "If enabled, document views are tracked, this can happen multiple times",
+ "fieldname": "track_views",
+ "fieldtype": "Check",
+ "label": "Track Views"
+ },
+ {
+ "default": "0",
+ "fieldname": "custom",
+ "fieldtype": "Check",
+ "label": "Custom?"
+ },
+ {
+ "default": "0",
+ "fieldname": "beta",
+ "fieldtype": "Check",
+ "label": "Beta"
+ },
+ {
+ "fieldname": "fields_section_break",
+ "fieldtype": "Section Break",
+ "label": "Fields",
+ "oldfieldtype": "Section Break"
+ },
+ {
+ "fieldname": "fields",
+ "fieldtype": "Table",
+ "label": "Fields",
+ "oldfieldname": "fields",
+ "oldfieldtype": "Table",
+ "options": "DocField"
+ },
+ {
+ "fieldname": "sb1",
+ "fieldtype": "Section Break",
+ "label": "Naming"
+ },
+ {
+ "description": "Naming Options:\n- field:[fieldname] - By Field
- naming_series: - By Naming Series (field called naming_series must be present
- Prompt - Prompt user for a name
- [series] - Series by prefix (separated by a dot); for example PRE.#####
\n- format:EXAMPLE-{MM}morewords{fieldname1}-{fieldname2}-{#####} - Replace all braced words (fieldnames, date words (DD, MM, YY), series) with their value. Outside braces, any characters can be used.
",
+ "fieldname": "autoname",
+ "fieldtype": "Data",
+ "label": "Auto Name",
+ "oldfieldname": "autoname",
+ "oldfieldtype": "Data"
+ },
+ {
+ "fieldname": "name_case",
+ "fieldtype": "Select",
+ "label": "Name Case",
+ "oldfieldname": "name_case",
+ "oldfieldtype": "Select",
+ "options": "\nTitle Case\nUPPER CASE"
+ },
+ {
+ "fieldname": "column_break_15",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "description",
+ "fieldtype": "Small Text",
+ "label": "Description",
+ "oldfieldname": "description",
+ "oldfieldtype": "Text"
+ },
+ {
+ "collapsible": 1,
+ "fieldname": "form_settings_section",
+ "fieldtype": "Section Break",
+ "label": "Form Settings"
+ },
+ {
+ "description": "Must be of type \"Attach Image\"",
+ "fieldname": "image_field",
+ "fieldtype": "Data",
+ "label": "Image Field"
+ },
+ {
+ "depends_on": "eval:!doc.istable",
+ "description": "Comments and Communications will be associated with this linked document",
+ "fieldname": "timeline_field",
+ "fieldtype": "Data",
+ "label": "Timeline Field"
+ },
+ {
+ "fieldname": "max_attachments",
+ "fieldtype": "Int",
+ "label": "Max Attachments",
+ "oldfieldname": "max_attachments",
+ "oldfieldtype": "Int"
+ },
+ {
+ "fieldname": "column_break_23",
+ "fieldtype": "Column Break"
+ },
+ {
+ "default": "0",
+ "fieldname": "hide_toolbar",
+ "fieldtype": "Check",
+ "label": "Hide Sidebar and Menu",
+ "oldfieldname": "hide_toolbar",
+ "oldfieldtype": "Check"
+ },
+ {
+ "default": "0",
+ "fieldname": "allow_copy",
+ "fieldtype": "Check",
+ "label": "Hide Copy",
+ "oldfieldname": "allow_copy",
+ "oldfieldtype": "Check"
+ },
+ {
+ "default": "1",
+ "fieldname": "allow_rename",
+ "fieldtype": "Check",
+ "label": "Allow Rename",
+ "oldfieldname": "allow_rename",
+ "oldfieldtype": "Check"
+ },
+ {
+ "default": "0",
+ "fieldname": "allow_import",
+ "fieldtype": "Check",
+ "label": "Allow Import (via Data Import Tool)"
+ },
+ {
+ "default": "0",
+ "fieldname": "allow_events_in_timeline",
+ "fieldtype": "Check",
+ "label": "Allow events in timeline"
+ },
+ {
+ "default": "0",
+ "fieldname": "allow_auto_repeat",
+ "fieldtype": "Check",
+ "label": "Allow Auto Repeat"
+ },
+ {
+ "collapsible": 1,
+ "fieldname": "view_settings",
+ "fieldtype": "Section Break",
+ "label": "View Settings"
+ },
+ {
+ "depends_on": "eval:!doc.istable",
+ "fieldname": "title_field",
+ "fieldtype": "Data",
+ "label": "Title Field"
+ },
+ {
+ "depends_on": "eval:!doc.istable",
+ "fieldname": "search_fields",
+ "fieldtype": "Data",
+ "label": "Search Fields",
+ "oldfieldname": "search_fields",
+ "oldfieldtype": "Data"
+ },
+ {
+ "fieldname": "default_print_format",
+ "fieldtype": "Data",
+ "label": "Default Print Format"
+ },
+ {
+ "default": "modified",
+ "depends_on": "eval:!doc.istable",
+ "fieldname": "sort_field",
+ "fieldtype": "Data",
+ "label": "Default Sort Field"
+ },
+ {
+ "default": "DESC",
+ "depends_on": "eval:!doc.istable",
+ "fieldname": "sort_order",
+ "fieldtype": "Select",
+ "label": "Default Sort Order",
+ "options": "ASC\nDESC"
+ },
+ {
+ "fieldname": "column_break_29",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "document_type",
+ "fieldtype": "Select",
+ "label": "Show in Module Section",
+ "oldfieldname": "document_type",
+ "oldfieldtype": "Select",
+ "options": "\nDocument\nSetup\nSystem\nOther"
+ },
+ {
+ "fieldname": "icon",
+ "fieldtype": "Data",
+ "label": "Icon"
+ },
+ {
+ "fieldname": "color",
+ "fieldtype": "Data",
+ "label": "Color"
+ },
+ {
+ "default": "0",
+ "fieldname": "show_preview_popup",
+ "fieldtype": "Check",
+ "label": "Show Preview Popup"
+ },
+ {
+ "default": "0",
+ "fieldname": "show_name_in_global_search",
+ "fieldtype": "Check",
+ "label": "Make \"name\" searchable in Global Search"
+ },
+ {
+ "depends_on": "eval:!doc.istable",
+ "fieldname": "sb2",
+ "fieldtype": "Section Break",
+ "label": "Permission Rules"
+ },
+ {
+ "fieldname": "permissions",
+ "fieldtype": "Table",
+ "label": "Permissions",
+ "oldfieldname": "permissions",
+ "oldfieldtype": "Table",
+ "options": "DocPerm"
+ },
+ {
+ "fieldname": "restrict_to_domain",
+ "fieldtype": "Link",
+ "label": "Restrict To Domain",
+ "options": "Domain"
+ },
+ {
+ "default": "0",
+ "fieldname": "read_only",
+ "fieldtype": "Check",
+ "label": "User Cannot Search",
+ "oldfieldname": "read_only",
+ "oldfieldtype": "Check"
+ },
+ {
+ "default": "0",
+ "fieldname": "in_create",
+ "fieldtype": "Check",
+ "label": "User Cannot Create",
+ "oldfieldname": "in_create",
+ "oldfieldtype": "Check"
+ },
+ {
+ "depends_on": "eval:doc.custom===0",
+ "fieldname": "web_view",
+ "fieldtype": "Section Break",
+ "label": "Web View"
+ },
+ {
+ "default": "0",
+ "fieldname": "has_web_view",
+ "fieldtype": "Check",
+ "label": "Has Web View"
+ },
+ {
+ "default": "0",
+ "depends_on": "has_web_view",
+ "fieldname": "allow_guest_to_view",
+ "fieldtype": "Check",
+ "label": "Allow Guest to View"
+ },
+ {
+ "depends_on": "eval:!doc.istable",
+ "fieldname": "route",
+ "fieldtype": "Data",
+ "label": "Route"
+ },
+ {
+ "depends_on": "has_web_view",
+ "fieldname": "is_published_field",
+ "fieldtype": "Data",
+ "label": "Is Published Field"
+ },
+ {
+ "collapsible": 1,
+ "fieldname": "advanced",
+ "fieldtype": "Section Break",
+ "hidden": 1,
+ "label": "Advanced"
+ },
+ {
+ "default": "InnoDB",
+ "depends_on": "eval:!doc.issingle",
+ "fieldname": "engine",
+ "fieldtype": "Select",
+ "label": "Database Engine",
+ "options": "InnoDB\nMyISAM"
+ },
+ {
+ "default": "0",
+ "description": "Tree structures are implemented using Nested Set",
+ "fieldname": "is_tree",
+ "fieldtype": "Check",
+ "label": "Is Tree"
+ },
+ {
+ "depends_on": "is_tree",
+ "fieldname": "nsm_parent_field",
+ "fieldtype": "Data",
+ "label": "Parent Field (Tree)"
+ },
+ {
+ "description": "URL for documentation or help",
+ "fieldname": "documentation",
+ "fieldtype": "Data",
+ "label": "Documentation Link"
+ },
+ {
+ "collapsible": 1,
+ "collapsible_depends_on": "actions",
+ "fieldname": "actions_section",
+ "fieldtype": "Section Break",
+ "label": "Actions"
+ },
+ {
+ "fieldname": "actions",
+ "fieldtype": "Table",
+ "label": "Actions",
+ "options": "DocType Action"
+ },
+ {
+ "collapsible": 1,
+ "collapsible_depends_on": "links",
+ "fieldname": "links_section",
+ "fieldtype": "Section Break",
+ "label": "Linked Documents"
+ },
+ {
+ "fieldname": "links",
+ "fieldtype": "Table",
+ "label": "Links",
+ "options": "DocType Link"
+ },
+ {
+ "depends_on": "email_append_to",
+ "fieldname": "subject_field",
+ "fieldtype": "Data",
+ "label": "Subject Field"
+ },
+ {
+ "depends_on": "email_append_to",
+ "fieldname": "sender_field",
+ "fieldtype": "Data",
+ "label": "Sender Field",
+ "mandatory_depends_on": "email_append_to"
+ },
+ {
+ "default": "0",
+ "fieldname": "email_append_to",
+ "fieldtype": "Check",
+ "label": "Allow document creation via Email"
+ },
+ {
+ "collapsible": 1,
+ "fieldname": "email_settings_sb",
+ "fieldtype": "Section Break",
+ "label": "Email Settings"
+ },
+ {
+ "default": "1",
+ "fieldname": "index_web_pages_for_search",
+ "fieldtype": "Check",
+ "label": "Index Web Pages for Search"
+ },
+ {
+ "default": "0",
+ "fieldname": "is_virtual",
+ "fieldtype": "Check",
+ "label": "Is Virtual"
+ },
+ {
+ "fieldname": "default_email_template",
+ "fieldtype": "Link",
+ "label": "Default Email Template",
+ "options": "Email Template"
+ },
+ {
+ "fieldname": "column_break_51",
+ "fieldtype": "Column Break"
+ },
+ {
+ "depends_on": "has_web_view",
+ "fieldname": "website_search_field",
+ "fieldtype": "Data",
+ "label": "Website Search Field"
+ },
+ {
+ "fieldname": "naming_rule",
+ "fieldtype": "Select",
+ "label": "Naming Rule",
+ "length": 40,
+ "options": "\nSet by user\nBy fieldname\nBy \"Naming Series\" field\nExpression\nExpression (old style)\nRandom\nBy script"
+ },
+ {
+ "fieldname": "migration_hash",
+ "fieldtype": "Data",
+ "hidden": 1
+ },
+ {
+ "fieldname": "states",
+ "fieldtype": "Table",
+ "label": "States",
+ "options": "DocType State"
+ },
+ {
+ "collapsible": 1,
+ "fieldname": "document_states_section",
+ "fieldtype": "Section Break",
+ "label": "Document States"
+ }
+ ],
+ "icon": "fa fa-bolt",
+ "idx": 6,
+ "links": [
+ {
+ "group": "Views",
+ "link_doctype": "Report",
+ "link_fieldname": "ref_doctype"
+ },
+ {
+ "group": "Workflow",
+ "link_doctype": "Workflow",
+ "link_fieldname": "document_type"
+ },
+ {
+ "group": "Workflow",
+ "link_doctype": "Notification",
+ "link_fieldname": "document_type"
+ },
+ {
+ "group": "Customization",
+ "link_doctype": "Custom Field",
+ "link_fieldname": "dt"
+ },
+ {
+ "group": "Customization",
+ "link_doctype": "Client Script",
+ "link_fieldname": "dt"
+ },
+ {
+ "group": "Customization",
+ "link_doctype": "Server Script",
+ "link_fieldname": "reference_doctype"
+ },
+ {
+ "group": "Workflow",
+ "link_doctype": "Webhook",
+ "link_fieldname": "webhook_doctype"
+ },
+ {
+ "group": "Views",
+ "link_doctype": "Print Format",
+ "link_fieldname": "doc_type"
+ },
+ {
+ "group": "Views",
+ "link_doctype": "Web Form",
+ "link_fieldname": "doc_type"
+ },
+ {
+ "group": "Views",
+ "link_doctype": "Calendar View",
+ "link_fieldname": "reference_doctype"
+ },
+ {
+ "group": "Views",
+ "link_doctype": "Kanban Board",
+ "link_fieldname": "reference_doctype"
+ },
+ {
+ "group": "Workflow",
+ "link_doctype": "Onboarding Step",
+ "link_fieldname": "reference_document"
+ },
+ {
+ "group": "Rules",
+ "link_doctype": "Auto Repeat",
+ "link_fieldname": "reference_doctype"
+ },
+ {
+ "group": "Rules",
+ "link_doctype": "Assignment Rule",
+ "link_fieldname": "document_type"
+ },
+ {
+ "group": "Rules",
+ "link_doctype": "Energy Point Rule",
+ "link_fieldname": "reference_doctype"
+ }
+ ],
+ "modified": "2021-12-09 14:53:10.717788",
+ "modified_by": "Administrator",
+ "module": "Core",
+ "name": "DocType",
+ "owner": "Administrator",
+ "permissions": [
+ {
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "System Manager",
+ "write": 1
+ },
+ {
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "Administrator",
+ "share": 1,
+ "write": 1
+ }
+ ],
+ "route": "doctype",
+ "search_fields": "module",
+ "show_name_in_global_search": 1,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_changes": 1
+}
\ No newline at end of file
diff --git a/frappe/core/doctype/doctype_state/__init__.py b/frappe/core/doctype/doctype_state/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/frappe/core/doctype/doctype_state/doctype_state.json b/frappe/core/doctype/doctype_state/doctype_state.json
new file mode 100644
index 0000000000..79797b41c5
--- /dev/null
+++ b/frappe/core/doctype/doctype_state/doctype_state.json
@@ -0,0 +1,50 @@
+{
+ "actions": [],
+ "creation": "2021-08-23 17:21:28.345841",
+ "doctype": "DocType",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "field_order": [
+ "title",
+ "color",
+ "custom"
+ ],
+ "fields": [
+ {
+ "fieldname": "title",
+ "fieldtype": "Data",
+ "in_list_view": 1,
+ "label": "Title",
+ "reqd": 1
+ },
+ {
+ "default": "Blue",
+ "fieldname": "color",
+ "fieldtype": "Select",
+ "in_list_view": 1,
+ "label": "Color",
+ "options": "Blue\nCyan\nGray\nGreen\nLight Blue\nOrange\nPink\nPurple\nRed\nYellow",
+ "reqd": 1
+ },
+ {
+ "default": "0",
+ "fieldname": "custom",
+ "fieldtype": "Check",
+ "hidden": 1,
+ "label": "Custom"
+ }
+ ],
+ "index_web_pages_for_search": 1,
+ "istable": 1,
+ "links": [],
+ "modified": "2021-12-14 14:14:55.716378",
+ "modified_by": "Administrator",
+ "module": "Core",
+ "name": "DocType State",
+ "owner": "Administrator",
+ "permissions": [],
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "states": [],
+ "track_changes": 1
+}
\ No newline at end of file
diff --git a/frappe/core/doctype/doctype_state/doctype_state.py b/frappe/core/doctype/doctype_state/doctype_state.py
new file mode 100644
index 0000000000..3172834180
--- /dev/null
+++ b/frappe/core/doctype/doctype_state/doctype_state.py
@@ -0,0 +1,8 @@
+# Copyright (c) 2021, Frappe Technologies and contributors
+# For license information, please see license.txt
+
+# import frappe
+from frappe.model.document import Document
+
+class DocTypeState(Document):
+ pass
diff --git a/frappe/custom/doctype/customize_form/customize_form.js b/frappe/custom/doctype/customize_form/customize_form.js
index 8ca6e0e54e..4862185b99 100644
--- a/frappe/custom/doctype/customize_form/customize_form.js
+++ b/frappe/custom/doctype/customize_form/customize_form.js
@@ -114,6 +114,7 @@ frappe.ui.form.on("Customize Form", {
frm.page.clear_icons();
if (frm.doc.doc_type) {
+ frm.page.set_title(__('Customize Form - {0}', [frm.doc.doc_type]));
frappe.customize_form.set_primary_action(frm);
frm.add_custom_button(
@@ -276,6 +277,21 @@ frappe.ui.form.on("DocType Action", {
}
});
+// can't delete standard states
+frappe.ui.form.on("DocType State", {
+ before_states_remove: function(frm, doctype, name) {
+ let row = frappe.get_doc(doctype, name);
+ if (!(row.custom || row.__islocal)) {
+ frappe.msgprint(__("Cannot delete standard document state."));
+ throw "cannot delete standard document state";
+ }
+ },
+ states_add: function(frm, cdt, cdn) {
+ let f = frappe.model.get_doc(cdt, cdn);
+ f.custom = 1;
+ }
+});
+
frappe.customize_form.set_primary_action = function(frm) {
frm.page.set_primary_action(__("Update"), function() {
if (frm.doc.doc_type) {
diff --git a/frappe/custom/doctype/customize_form/customize_form.json b/frappe/custom/doctype/customize_form/customize_form.json
index c2940a92e3..bdf95ad351 100644
--- a/frappe/custom/doctype/customize_form/customize_form.json
+++ b/frappe/custom/doctype/customize_form/customize_form.json
@@ -41,6 +41,8 @@
"actions",
"document_links_section",
"links",
+ "document_states_section",
+ "states",
"section_break_8",
"sort_field",
"column_break_10",
@@ -280,6 +282,20 @@
"fieldname": "autoname",
"fieldtype": "Data",
"label": "Auto Name"
+ },
+ {
+ "collapsible": 1,
+ "collapsible_depends_on": "states",
+ "depends_on": "doc_type",
+ "fieldname": "document_states_section",
+ "fieldtype": "Section Break",
+ "label": "Document States"
+ },
+ {
+ "fieldname": "states",
+ "fieldtype": "Table",
+ "label": "States",
+ "options": "DocType State"
}
],
"hide_toolbar": 1,
@@ -288,10 +304,11 @@
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
- "modified": "2021-06-21 19:01:06.920663",
+ "modified": "2021-12-14 16:45:04.308690",
"modified_by": "Administrator",
"module": "Custom",
"name": "Customize Form",
+ "naming_rule": "Expression (old style)",
"owner": "Administrator",
"permissions": [
{
@@ -308,5 +325,6 @@
"search_fields": "doc_type",
"sort_field": "modified",
"sort_order": "DESC",
+ "states": [],
"track_changes": 1
}
\ No newline at end of file
diff --git a/frappe/custom/doctype/customize_form/customize_form.py b/frappe/custom/doctype/customize_form/customize_form.py
index 94f25a41aa..0b17200c6f 100644
--- a/frappe/custom/doctype/customize_form/customize_form.py
+++ b/frappe/custom/doctype/customize_form/customize_form.py
@@ -72,7 +72,7 @@ class CustomizeForm(Document):
new_d[prop] = d.get(prop)
self.append("fields", new_d)
- for fieldname in ('links', 'actions'):
+ for fieldname in ('links', 'actions', 'states'):
for d in meta.get(fieldname):
self.append(fieldname, d)
@@ -258,7 +258,8 @@ class CustomizeForm(Document):
'''
for doctype, fieldname, field_map in (
('DocType Link', 'links', doctype_link_properties),
- ('DocType Action', 'actions', doctype_action_properties)
+ ('DocType Action', 'actions', doctype_action_properties),
+ ('DocType State', 'states', doctype_state_properties),
):
has_custom = False
items = []
@@ -568,6 +569,11 @@ doctype_action_properties = {
'hidden': 'Check'
}
+doctype_state_properties = {
+ 'title': 'Data',
+ 'color': 'Select'
+}
+
ALLOWED_FIELDTYPE_CHANGE = (
('Currency', 'Float', 'Percent'),
diff --git a/frappe/custom/doctype/property_setter/property_setter.json b/frappe/custom/doctype/property_setter/property_setter.json
index fcb36637fe..9707f1ee1c 100644
--- a/frappe/custom/doctype/property_setter/property_setter.json
+++ b/frappe/custom/doctype/property_setter/property_setter.json
@@ -37,7 +37,7 @@
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Applied On",
- "options": "\nDocField\nDocType\nDocType Link\nDocType Action",
+ "options": "\nDocField\nDocType\nDocType Link\nDocType Action\nDocType State",
"read_only_depends_on": "eval:!doc.__islocal",
"reqd": 1
},
@@ -109,7 +109,7 @@
"idx": 1,
"index_web_pages_for_search": 1,
"links": [],
- "modified": "2021-09-04 12:46:17.860769",
+ "modified": "2021-12-14 14:15:41.929071",
"modified_by": "Administrator",
"module": "Custom",
"name": "Property Setter",
@@ -141,5 +141,6 @@
"search_fields": "doc_type,property",
"sort_field": "modified",
"sort_order": "DESC",
+ "states": [],
"track_changes": 1
}
\ No newline at end of file
diff --git a/frappe/desk/doctype/kanban_board_column/kanban_board_column.json b/frappe/desk/doctype/kanban_board_column/kanban_board_column.json
index 95d9294e9a..c0acde5da5 100644
--- a/frappe/desk/doctype/kanban_board_column/kanban_board_column.json
+++ b/frappe/desk/doctype/kanban_board_column/kanban_board_column.json
@@ -1,155 +1,55 @@
{
- "allow_copy": 0,
- "allow_import": 0,
- "allow_rename": 0,
- "beta": 0,
- "creation": "2016-10-19 12:26:42.569185",
- "custom": 0,
- "docstatus": 0,
- "doctype": "DocType",
- "document_type": "",
- "editable_grid": 1,
- "engine": "InnoDB",
+ "actions": [],
+ "creation": "2016-10-19 12:26:42.569185",
+ "doctype": "DocType",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "field_order": [
+ "column_name",
+ "status",
+ "indicator",
+ "order"
+ ],
"fields": [
{
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "column_name",
- "fieldtype": "Data",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_list_view": 1,
- "in_standard_filter": 0,
- "label": "Column Name",
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0
- },
+ "fieldname": "column_name",
+ "fieldtype": "Data",
+ "in_list_view": 1,
+ "label": "Column Name"
+ },
{
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "default": "Active",
- "fieldname": "status",
- "fieldtype": "Select",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_list_view": 1,
- "in_standard_filter": 0,
- "label": "Status",
- "length": 0,
- "no_copy": 0,
- "options": "Active\nArchived",
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0
- },
+ "default": "Active",
+ "fieldname": "status",
+ "fieldtype": "Select",
+ "in_list_view": 1,
+ "label": "Status",
+ "options": "Active\nArchived"
+ },
{
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "default": "darkgrey",
- "fieldname": "indicator",
- "fieldtype": "Select",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_list_view": 1,
- "in_standard_filter": 0,
- "label": "Indicator",
- "length": 0,
- "no_copy": 0,
- "options": "blue\norange\nred\ngreen\ndarkgrey\npurple\nyellow\nlightblue",
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0
- },
+ "default": "Gray",
+ "fieldname": "indicator",
+ "fieldtype": "Select",
+ "in_list_view": 1,
+ "label": "Indicator",
+ "options": "Blue\nCyan\nGray\nGreen\nLight Blue\nOrange\nPink\nPurple\nRed\nRed\nYellow"
+ },
{
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "order",
- "fieldtype": "Code",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Order",
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0
+ "fieldname": "order",
+ "fieldtype": "Code",
+ "label": "Order"
}
- ],
- "hide_heading": 0,
- "hide_toolbar": 0,
- "idx": 0,
- "image_view": 0,
- "in_create": 0,
-
- "is_submittable": 0,
- "issingle": 0,
- "istable": 1,
- "max_attachments": 0,
- "modified": "2017-01-17 15:23:43.520379",
- "modified_by": "Administrator",
- "module": "Desk",
- "name": "Kanban Board Column",
- "name_case": "",
- "owner": "Administrator",
- "permissions": [],
- "quick_entry": 1,
- "read_only": 0,
- "read_only_onload": 0,
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 1,
- "track_seen": 0
+ ],
+ "istable": 1,
+ "links": [],
+ "modified": "2021-12-14 13:13:38.804259",
+ "modified_by": "Administrator",
+ "module": "Desk",
+ "name": "Kanban Board Column",
+ "owner": "Administrator",
+ "permissions": [],
+ "quick_entry": 1,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "states": [],
+ "track_changes": 1
}
\ No newline at end of file
diff --git a/frappe/model/base_document.py b/frappe/model/base_document.py
index 1826cca9a3..1fd3784fcc 100644
--- a/frappe/model/base_document.py
+++ b/frappe/model/base_document.py
@@ -338,7 +338,7 @@ class BaseDocument(object):
return self.meta.get_field(fieldname).options
except AttributeError:
if self.doctype == 'DocType':
- return dict(links='DocType Link', actions='DocType Action').get(fieldname)
+ return dict(links='DocType Link', actions='DocType Action', states='DocType State').get(fieldname)
raise
def get_parentfield_of_doctype(self, doctype):
diff --git a/frappe/model/meta.py b/frappe/model/meta.py
index cd0d8e0f3a..579191efbe 100644
--- a/frappe/model/meta.py
+++ b/frappe/model/meta.py
@@ -66,7 +66,7 @@ def load_doctype_from_file(doctype):
class Meta(Document):
_metaclass = True
default_fields = list(default_fields)[1:]
- special_doctypes = ("DocField", "DocPerm", "DocType", "Module Def", 'DocType Action', 'DocType Link')
+ special_doctypes = ("DocField", "DocPerm", "DocType", "Module Def", 'DocType Action', 'DocType Link', 'DocType State')
def __init__(self, doctype):
self._fields = {}
@@ -184,7 +184,8 @@ class Meta(Document):
"fields": "DocField",
"permissions": "DocPerm",
"actions": "DocType Action",
- 'links': 'DocType Link'
+ "links": "DocType Link",
+ "states": "DocType State",
}.get(fieldname)
def get_field(self, fieldname):
@@ -343,8 +344,14 @@ class Meta(Document):
d.set(ps.property, cast(ps.property_type, ps.value))
break
+ elif ps.doctype_or_field=='DocType State':
+ for d in self.states:
+ if d.name == ps.row_name:
+ d.set(ps.property, cast(ps.property_type, ps.value))
+ break
+
def add_custom_links_and_actions(self):
- for doctype, fieldname in (('DocType Link', 'links'), ('DocType Action', 'actions')):
+ for doctype, fieldname in (('DocType Link', 'links'), ('DocType Action', 'actions'), ('DocType State', 'states')):
# ignore_ddl because the `custom` column was added later via a patch
for d in frappe.get_all(doctype, fields='*', filters=dict(parent=self.name, custom=1), ignore_ddl=True):
self.append(fieldname, d)
@@ -571,6 +578,7 @@ DOCTYPE_TABLE_FIELDS = [
frappe._dict({"fieldname": "permissions", "options": "DocPerm"}),
frappe._dict({"fieldname": "actions", "options": "DocType Action"}),
frappe._dict({"fieldname": "links", "options": "DocType Link"}),
+ frappe._dict({"fieldname": "states", "options": "DocType State"}),
]
#######
diff --git a/frappe/model/sync.py b/frappe/model/sync.py
index 42bb16cbc2..9ba14d5e68 100644
--- a/frappe/model/sync.py
+++ b/frappe/model/sync.py
@@ -30,7 +30,7 @@ def sync_for(app_name, force=0, reset_permissions=False):
FRAPPE_PATH = frappe.get_app_path("frappe")
- for core_module in ["docfield", "docperm", "doctype_action", "doctype_link", "role", "has_role", "doctype"]:
+ for core_module in ["docfield", "docperm", "doctype_action", "doctype_link", "doctype_state", "role", "has_role", "doctype"]:
files.append(os.path.join(FRAPPE_PATH, "core", "doctype", core_module, f"{core_module}.json"))
for custom_module in ["custom_field", "property_setter"]:
diff --git a/frappe/modules/import_file.py b/frappe/modules/import_file.py
index 50a56d9dbb..1219fbb045 100644
--- a/frappe/modules/import_file.py
+++ b/frappe/modules/import_file.py
@@ -8,7 +8,7 @@ import frappe
from frappe.model.base_document import get_controller
from frappe.modules import get_module_path, scrub_dt_dn
from frappe.query_builder import DocType
-from frappe.utils import get_datetime_str, now
+from frappe.utils import get_datetime, now
def caclulate_hash(path: str) -> str:
@@ -109,7 +109,9 @@ def import_file_by_path(path: str,force: bool = False,data_import: bool = False,
# modified timestamp in db, none if doctype's first import
db_modified_timestamp = frappe.db.get_value(doc["doctype"], doc["name"], "modified")
- is_db_timestamp_latest = db_modified_timestamp and doc.get("modified") <= get_datetime_str(db_modified_timestamp)
+ is_db_timestamp_latest = db_modified_timestamp and (
+ get_datetime(doc.get("modified")) <= get_datetime(db_modified_timestamp)
+ )
if not force or db_modified_timestamp:
try:
@@ -120,11 +122,11 @@ def import_file_by_path(path: str,force: bool = False,data_import: bool = False,
# if hash exists and is equal no need to update
if stored_hash and stored_hash == calculated_hash:
- return False
+ continue
# if hash doesn't exist, check if db timestamp is same as json timestamp, add hash if from doctype
if is_db_timestamp_latest and doc["doctype"] != "DocType":
- return False
+ continue
import_doc(
docdict=doc,
@@ -161,7 +163,7 @@ def import_file_by_path(path: str,force: bool = False,data_import: bool = False,
def is_timestamp_changed(doc):
# check if timestamps match
db_modified = frappe.db.get_value(doc["doctype"], doc["name"], "modified")
- return not (db_modified and doc.get("modified") == get_datetime_str(db_modified))
+ return not (db_modified and get_datetime(doc.get("modified")) == get_datetime(db_modified))
def read_doc_from_file(path):
diff --git a/frappe/patches.txt b/frappe/patches.txt
index 3078159c3d..d8e41f705b 100644
--- a/frappe/patches.txt
+++ b/frappe/patches.txt
@@ -187,3 +187,4 @@ frappe.patches.v14_0.copy_mail_data #08.03.21
frappe.patches.v14_0.update_workspace2 # 20.09.2021
frappe.patches.v14_0.update_github_endpoints #08-11-2021
frappe.patches.v14_0.remove_db_aggregation
+frappe.patches.v14_0.update_color_names_in_kanban_board_column
diff --git a/frappe/patches/v14_0/update_color_names_in_kanban_board_column.py b/frappe/patches/v14_0/update_color_names_in_kanban_board_column.py
new file mode 100644
index 0000000000..ea8a10e43a
--- /dev/null
+++ b/frappe/patches/v14_0/update_color_names_in_kanban_board_column.py
@@ -0,0 +1,22 @@
+# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
+# MIT License. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+ frappe.reload_doc("desk", "doctype", "kanban_board_column")
+ indicator_map = {
+ 'blue': 'Blue',
+ 'orange': 'Orange',
+ 'red': 'Red',
+ 'green': 'Green',
+ 'darkgrey': 'Gray',
+ 'gray': 'Gray',
+ 'purple': 'Purple',
+ 'yellow': 'Yellow',
+ 'lightblue': 'Light Blue',
+ }
+ for d in frappe.db.get_all('Kanban Board Column', fields=['name', 'indicator']):
+ color_name = indicator_map.get(d.indicator, 'Gray')
+ frappe.db.set_value('Kanban Board Column', d.name, 'indicator', color_name)
diff --git a/frappe/public/js/frappe/list/list_view.js b/frappe/public/js/frappe/list/list_view.js
index 3c9f1e39fb..0efeccbfe0 100644
--- a/frappe/public/js/frappe/list/list_view.js
+++ b/frappe/public/js/frappe/list/list_view.js
@@ -312,7 +312,7 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
let $check_all_checkbox = this.$checkbox_actions.find(".list-check-all");
if ($check_all_checkbox.prop("checked") && target && !target.prop("checked")) {
- $check_all_checkbox.prop("checked", false);
+ $check_all_checkbox.prop("checked", false);
}
$check_all_checkbox.prop("checked", this.$checks.length === this.data.length);
diff --git a/frappe/public/js/frappe/model/indicator.js b/frappe/public/js/frappe/model/indicator.js
index 575ab35b29..2e6bfff81d 100644
--- a/frappe/public/js/frappe/model/indicator.js
+++ b/frappe/public/js/frappe/model/indicator.js
@@ -10,6 +10,8 @@ frappe.has_indicator = function(doctype) {
} else if(frappe.meta.has_field(doctype, 'enabled')
|| frappe.meta.has_field(doctype, 'disabled')) {
return true;
+ } else if (frappe.meta.has_field(doctype, 'status') && frappe.get_meta(doctype).states.length) {
+ return true;
}
return false;
}
@@ -21,6 +23,7 @@ frappe.get_indicator = function(doc, doctype) {
if(!doctype) doctype = doc.doctype;
+ let meta = frappe.get_meta(doctype);
var workflow = frappe.workflow.workflows[doctype];
var without_workflow = workflow ? workflow['override_status'] : true;
@@ -61,6 +64,13 @@ frappe.get_indicator = function(doc, doctype) {
return [__("Cancelled"), "red", "docstatus,=,2"];
}
+ // based on document state
+ if (doc.status && meta && meta.states && meta.states.find(d => d.title === doc.status)) {
+ let state = meta.states.find(d => d.title === doc.status);
+ let color_class = frappe.scrub(state.color, '-');
+ return [__(doc.status), color_class, "status,=," + doc.status];
+ }
+
if(settings.get_indicator) {
var indicator = settings.get_indicator(doc);
if(indicator) return indicator;
diff --git a/frappe/public/js/frappe/views/kanban/kanban_board.js b/frappe/public/js/frappe/views/kanban/kanban_board.js
index 1d7ea37fe6..c1e3c3bfe6 100644
--- a/frappe/public/js/frappe/views/kanban/kanban_board.js
+++ b/frappe/public/js/frappe/views/kanban/kanban_board.js
@@ -467,7 +467,7 @@ frappe.provide("frappe.views");
'kanban_column', {
title: column.title,
doctype: store.getState().doctype,
- indicator: column.indicator
+ indicator: frappe.scrub(column.indicator, '-')
})).appendTo(wrapper);
self.$kanban_cards = self.$kanban_column.find('.kanban-cards');
}
@@ -581,13 +581,12 @@ frappe.provide("frappe.views");
}
});
get_column_indicators(function(indicators) {
- var html = '';
- html += indicators.reduce(function(prev, curr) {
- return prev + '';
- }, "");
- html += '';
+ let html = `${
+ indicators.map(indicator => {
+ let classname = frappe.scrub(indicator, '-');
+ return ``
+ }).join('')
+ }`;
self.$kanban_column.find(".column-options .dropdown-menu")
.append(html);
});
diff --git a/frappe/public/js/frappe/widgets/widget_dialog.js b/frappe/public/js/frappe/widgets/widget_dialog.js
index 9262627f02..5676a834fe 100644
--- a/frappe/public/js/frappe/widgets/widget_dialog.js
+++ b/frappe/public/js/frappe/widgets/widget_dialog.js
@@ -352,6 +352,7 @@ class ShortcutDialog extends WidgetDialog {
label: __("Color"),
options: ["Grey", "Green", "Red", "Orange", "Pink", "Yellow", "Blue", "Cyan"],
default: "Grey",
+ input_class: "color-select",
onchange: () => {
let color = this.dialog.fields_dict.color.value.toLowerCase();
let $select = this.dialog.fields_dict.color.$input;
diff --git a/frappe/public/scss/common/global.scss b/frappe/public/scss/common/global.scss
index 44b6e9ce34..0324b75bfb 100644
--- a/frappe/public/scss/common/global.scss
+++ b/frappe/public/scss/common/global.scss
@@ -119,7 +119,7 @@ input[type="checkbox"] {
}
.frappe-control[data-fieldtype="Select"].frappe-control[data-fieldname="color"] {
- select {
+ .color-select {
padding-left: 40px;
}
diff --git a/frappe/public/scss/common/indicator.scss b/frappe/public/scss/common/indicator.scss
index 13162ab6b1..3006039a3d 100644
--- a/frappe/public/scss/common/indicator.scss
+++ b/frappe/public/scss/common/indicator.scss
@@ -163,9 +163,13 @@
@include indicator-pill-color('purple');
}
-.indicator-pill.lightblue,
-.indicator-pill-right.lightblue,
-.indicator-pill-round.lightblue {
+.indicator.light-blue {
+ @include indicator-color('light-blue');
+}
+
+.indicator-pill.light-blue,
+.indicator-pill-right.light-blue,
+.indicator-pill-round.light-blue {
@include indicator-pill-color('light-blue');
}
diff --git a/frappe/utils/install.py b/frappe/utils/install.py
index c8c118ede8..bdc5fdfbc5 100644
--- a/frappe/utils/install.py
+++ b/frappe/utils/install.py
@@ -9,6 +9,7 @@ def before_install():
frappe.reload_doc("core", "doctype", "docperm")
frappe.reload_doc("core", "doctype", "doctype_action")
frappe.reload_doc("core", "doctype", "doctype_link")
+ frappe.reload_doc("core", "doctype", "doctype_state")
frappe.reload_doc("desk", "doctype", "form_tour_step")
frappe.reload_doc("desk", "doctype", "form_tour")
frappe.reload_doc("core", "doctype", "doctype")