Skip to content

Commit

Permalink
fix: renamed data_fields to rows
Browse files Browse the repository at this point in the history
  • Loading branch information
shariquerik committed Nov 27, 2023
1 parent 84c621a commit 497bc8b
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 13 deletions.
11 changes: 6 additions & 5 deletions crm/api/doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,21 @@ def get_list_data(doctype: str, filters: dict, order_by: str):
columns = []
rows = []

data_fields = []

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)
data_fields = frappe.parse_json(list_view_settings.data_fields)
rows = frappe.parse_json(list_view_settings.rows)
else:
list = get_controller(doctype)

if hasattr(list, "default_list_data"):
columns = list.default_list_data().get("columns")
data_fields = list.default_list_data().get("data_fields")
rows = list.default_list_data().get("rows")

rows = [i['key'] for i in columns] + data_fields
# check if rows has all keys from columns if not add them
for column in columns:
if column.get("key") not in rows:
rows.append(column.get("key"))

data = frappe.get_all(
doctype,
Expand Down
13 changes: 11 additions & 2 deletions crm/fcrm/doctype/crm_deal/crm_deal.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,17 @@ def default_list_data():
'width': '8rem',
},
]
data_fields = ['name']
return {'columns': columns, 'data_fields': data_fields}
rows = [
"name",
"organization",
"annual_revenue",
"status",
"email",
"mobile_no",
"deal_owner",
"modified",
]
return {'columns': columns, 'rows': rows}

@frappe.whitelist()
def add_contact(deal, contact):
Expand Down
15 changes: 13 additions & 2 deletions crm/fcrm/doctype/crm_lead/crm_lead.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,19 @@ def default_list_data():
'width': '8rem',
},
]
data_fields = ['name', 'first_name', 'image']
return {'columns': columns, 'data_fields': data_fields}
rows = [
"name",
"lead_name",
"organization",
"status",
"email",
"mobile_no",
"lead_owner",
"first_name",
"modified",
"image",
]
return {'columns': columns, 'rows': rows}

@frappe.whitelist()
def convert_to_deal(lead):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"field_order": [
"user",
"columns",
"data_fields"
"rows"
],
"fields": [
{
Expand All @@ -23,14 +23,14 @@
"options": "User"
},
{
"fieldname": "data_fields",
"fieldname": "rows",
"fieldtype": "Code",
"label": "Data Fields"
"label": "Rows"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-11-27 18:47:23.123396",
"modified": "2023-11-28 00:17:42.675332",
"modified_by": "Administrator",
"module": "FCRM",
"name": "CRM List View Settings",
Expand Down

0 comments on commit 497bc8b

Please sign in to comment.