diff --git a/crm/api/doc.py b/crm/api/doc.py index 02d14b993..dbadf320d 100644 --- a/crm/api/doc.py +++ b/crm/api/doc.py @@ -57,10 +57,13 @@ def get_list_data(doctype: str, filters: dict, order_by: str): ] rows = ["name"] + is_default = True + if frappe.db.exists("CRM List View Settings", doctype): list_view_settings = frappe.get_doc("CRM List View Settings", doctype) columns = frappe.parse_json(list_view_settings.columns) rows = frappe.parse_json(list_view_settings.rows) + is_default = False else: list = get_controller(doctype) @@ -113,7 +116,13 @@ def get_list_data(doctype: str, filters: dict, order_by: str): if field not in fields: fields.append(field) - return {'data': data, 'columns': columns, 'rows': rows, 'fields': fields} + return { + "data": data, + "columns": columns, + "rows": rows, + "fields": fields, + "is_default": is_default, + } @frappe.whitelist() diff --git a/crm/fcrm/doctype/crm_list_view_settings/crm_list_view_settings.py b/crm/fcrm/doctype/crm_list_view_settings/crm_list_view_settings.py index ea5917282..66770ce8c 100644 --- a/crm/fcrm/doctype/crm_list_view_settings/crm_list_view_settings.py +++ b/crm/fcrm/doctype/crm_list_view_settings/crm_list_view_settings.py @@ -43,3 +43,8 @@ def sync_default_list_rows(doctype): rows = list.default_list_data().get("rows") return rows + +@frappe.whitelist() +def reset_to_default(doctype): + if frappe.db.exists("CRM List View Settings", doctype): + frappe.delete_doc("CRM List View Settings", doctype) \ No newline at end of file diff --git a/frontend/src/components/Icons/ReloadIcon.vue b/frontend/src/components/Icons/ReloadIcon.vue new file mode 100644 index 000000000..09c8e6c85 --- /dev/null +++ b/frontend/src/components/Icons/ReloadIcon.vue @@ -0,0 +1,22 @@ + + + diff --git a/frontend/src/components/ViewSettings.vue b/frontend/src/components/ViewSettings.vue index a678be040..f6189b96f 100644 --- a/frontend/src/components/ViewSettings.vue +++ b/frontend/src/components/ViewSettings.vue @@ -45,7 +45,7 @@ -