fix: renamed is_default to is_standard

This commit is contained in:
Shariq Ansari 2025-02-20 12:51:35 +05:30
parent 0f5c45c265
commit 4d3a90cf3c
4 changed files with 25 additions and 25 deletions

View File

@ -276,7 +276,7 @@ def get_data(
default_view_filters = {
"dt": doctype,
"type": view_type or "list",
"is_default": 1,
"is_standard": 1,
"user": frappe.session.user,
}

View File

@ -8,7 +8,7 @@
"label",
"icon",
"user",
"is_default",
"is_standard",
"column_break_zacm",
"type",
"dt",
@ -112,12 +112,6 @@
"fieldtype": "Check",
"label": "Public"
},
{
"default": "0",
"fieldname": "is_default",
"fieldtype": "Check",
"label": "Is Default"
},
{
"fieldname": "icon",
"fieldtype": "Data",
@ -178,11 +172,17 @@
"fieldname": "title_field",
"fieldtype": "Data",
"label": "Title Field"
},
{
"default": "0",
"fieldname": "is_standard",
"fieldtype": "Check",
"label": "Is Standard"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2024-06-25 19:40:12.067788",
"modified": "2025-02-20 12:41:51.574655",
"modified_by": "Administrator",
"module": "FCRM",
"name": "CRM View Settings",

View File

@ -153,7 +153,7 @@ def set_as_default(name=None, type=None, doctype=None):
@frappe.whitelist()
def create_or_update_default_view(view):
def create_or_update_standard_view(view):
view = frappe._dict(view)
filters = parse_json(view.filters) or {}
@ -173,7 +173,7 @@ def create_or_update_default_view(view):
doc = frappe.db.exists(
"CRM View Settings",
{"dt": view.doctype, "type": view.type or "list", "is_default": True, "user": frappe.session.user},
{"dt": view.doctype, "type": view.type or "list", "is_standard": True, "user": frappe.session.user},
)
if doc:
doc = frappe.get_doc("CRM View Settings", doc)
@ -210,5 +210,5 @@ def create_or_update_default_view(view):
doc.kanban_fields = json.dumps(kanban_fields)
doc.columns = json.dumps(columns)
doc.rows = json.dumps(rows)
doc.is_default = True
doc.is_standard = True
doc.insert()

View File

@ -310,13 +310,13 @@ const currentView = computed(() => {
label:
_view?.label || props.options?.defaultViewName || getViewType().label,
icon: _view?.icon || getViewType().icon,
is_default: !_view || _view.is_default,
is_standard: !_view || _view.is_standard,
}
})
usePageMeta(() => {
let label = currentView.value.label
if (currentView.value.is_default) {
if (currentView.value.is_standard) {
let routeName = route.name
label = `${routeName} - ${label}`
}
@ -558,7 +558,7 @@ const viewsDropdownOptions = computed(() => {
})
let publicViews = list.value.data.views.filter((v) => v.public)
let savedViews = list.value.data.views.filter(
(v) => !v.pinned && !v.public && !v.is_default,
(v) => !v.pinned && !v.public && !v.is_standard,
)
let pinnedViews = list.value.data.views.filter((v) => v.pinned)
@ -662,7 +662,7 @@ function updateFilter(filters) {
list.value.reload()
if (!route.query.view) {
create_or_update_default_view()
createOrUpdateStandardView()
}
}
@ -677,7 +677,7 @@ function updateSort(order_by) {
list.value.reload()
if (!route.query.view) {
create_or_update_default_view()
createOrUpdateStandardView()
}
}
@ -692,7 +692,7 @@ function updateGroupBy(group_by_field) {
list.value.reload()
if (!route.query.view) {
create_or_update_default_view()
createOrUpdateStandardView()
}
}
@ -726,7 +726,7 @@ function updateColumns(obj) {
viewUpdated.value = true
if (!route.query.view) {
create_or_update_default_view()
createOrUpdateStandardView()
}
}
@ -768,7 +768,7 @@ async function updateKanbanSettings(data) {
list.value.reload()
if (!route.query.view) {
create_or_update_default_view()
createOrUpdateStandardView()
} else if (!data.column_field) {
if (isDirty) {
$dialog({
@ -780,14 +780,14 @@ async function updateKanbanSettings(data) {
label: __('Update'),
variant: 'solid',
onClick: (close) => {
update_custom_view()
updateCustomView()
close()
},
},
],
})
} else {
update_custom_view()
updateCustomView()
}
}
}
@ -811,11 +811,11 @@ function loadMoreKanban(columnName) {
list.value.reload()
}
function create_or_update_default_view() {
function createOrUpdateStandardView() {
if (route.query.view) return
view.value.doctype = props.doctype
call(
'crm.fcrm.doctype.crm_view_settings.crm_view_settings.create_or_update_default_view',
'crm.fcrm.doctype.crm_view_settings.crm_view_settings.create_or_update_standard_view',
{
view: view.value,
},
@ -842,7 +842,7 @@ function create_or_update_default_view() {
})
}
function update_custom_view() {
function updateCustomView() {
viewUpdated.value = false
view.value = {
doctype: props.doctype,