fix: load default kanban settings if does not exist
This commit is contained in:
parent
49e57f749c
commit
6617cd1fd4
@ -315,12 +315,16 @@ def get_data(
|
|||||||
|
|
||||||
if not title_field:
|
if not title_field:
|
||||||
title_field = "name"
|
title_field = "name"
|
||||||
|
if hasattr(_list, "default_kanban_settings"):
|
||||||
|
title_field = _list.default_kanban_settings().get("title_field")
|
||||||
|
|
||||||
if title_field not in rows:
|
if title_field not in rows:
|
||||||
rows.append(title_field)
|
rows.append(title_field)
|
||||||
|
|
||||||
if not kanban_fields:
|
if not kanban_fields:
|
||||||
kanban_fields = ["name"]
|
kanban_fields = ["name"]
|
||||||
|
if hasattr(_list, "default_kanban_settings"):
|
||||||
|
kanban_fields = json.loads(_list.default_kanban_settings().get("kanban_fields"))
|
||||||
|
|
||||||
for field in kanban_fields:
|
for field in kanban_fields:
|
||||||
if field not in rows:
|
if field not in rows:
|
||||||
@ -442,6 +446,10 @@ def get_data(
|
|||||||
"columns": columns,
|
"columns": columns,
|
||||||
"rows": rows,
|
"rows": rows,
|
||||||
"fields": fields,
|
"fields": fields,
|
||||||
|
"column_field": column_field,
|
||||||
|
"title_field": title_field,
|
||||||
|
"kanban_columns": kanban_columns,
|
||||||
|
"kanban_fields": kanban_fields,
|
||||||
"group_by_field": group_by_field,
|
"group_by_field": group_by_field,
|
||||||
"page_length": page_length,
|
"page_length": page_length,
|
||||||
"page_length_count": page_length_count,
|
"page_length_count": page_length_count,
|
||||||
|
|||||||
@ -190,6 +190,13 @@ class CRMDeal(Document):
|
|||||||
]
|
]
|
||||||
return {'columns': columns, 'rows': rows}
|
return {'columns': columns, 'rows': rows}
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def default_kanban_settings():
|
||||||
|
return {
|
||||||
|
"column_field": "status",
|
||||||
|
"title_field": "organization",
|
||||||
|
"kanban_fields": '["annual_revenue", "email", "mobile_no", "_assign", "modified"]'
|
||||||
|
}
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def add_contact(deal, contact):
|
def add_contact(deal, contact):
|
||||||
|
|||||||
@ -324,6 +324,15 @@ class CRMLead(Document):
|
|||||||
]
|
]
|
||||||
return {'columns': columns, 'rows': rows}
|
return {'columns': columns, 'rows': rows}
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def default_kanban_settings():
|
||||||
|
return {
|
||||||
|
"column_field": "status",
|
||||||
|
"title_field": "lead_name",
|
||||||
|
"kanban_fields": '["organization", "email", "mobile_no", "_assign", "modified"]'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def convert_to_deal(lead, doc=None):
|
def convert_to_deal(lead, doc=None):
|
||||||
if not (doc and doc.flags.get("ignore_permissions")) and not frappe.has_permission("CRM Lead", "write", lead):
|
if not (doc and doc.flags.get("ignore_permissions")) and not frappe.has_permission("CRM Lead", "write", lead):
|
||||||
|
|||||||
@ -60,3 +60,11 @@ class CRMTask(Document):
|
|||||||
"modified",
|
"modified",
|
||||||
]
|
]
|
||||||
return {'columns': columns, 'rows': rows}
|
return {'columns': columns, 'rows': rows}
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def default_kanban_settings():
|
||||||
|
return {
|
||||||
|
"column_field": "status",
|
||||||
|
"title_field": "title",
|
||||||
|
"kanban_fields": '["description", "priority", "creation"]'
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user