fix: created api to get sort options for any doctype
This commit is contained in:
parent
36b10bffae
commit
c0335aed45
@ -44,3 +44,18 @@ class CRMLead(Document):
|
||||
|
||||
if self.is_new() or not self.image:
|
||||
self.image = has_gravatar(self.email)
|
||||
|
||||
@staticmethod
|
||||
def sort_options():
|
||||
return [
|
||||
{ "label": 'Created', "value": 'creation' },
|
||||
{ "label": 'Modified', "value": 'modified' },
|
||||
{ "label": 'Status', "value": 'status' },
|
||||
{ "label": 'Lead owner', "value": 'lead_owner' },
|
||||
{ "label": 'Organization', "value": 'organization_name' },
|
||||
{ "label": 'Name', "value": 'lead_name' },
|
||||
{ "label": 'First Name', "value": 'first_name' },
|
||||
{ "label": 'Last Name', "value": 'last_name' },
|
||||
{ "label": 'Email', "value": 'email' },
|
||||
{ "label": 'Mobile no', "value": 'mobile_no' },
|
||||
]
|
||||
12
crm/extends/doc.py
Normal file
12
crm/extends/doc.py
Normal file
@ -0,0 +1,12 @@
|
||||
import frappe
|
||||
from frappe.model.document import get_controller
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def sort_options(doctype: str):
|
||||
c = get_controller(doctype)
|
||||
|
||||
if not hasattr(c, "sort_options"):
|
||||
return []
|
||||
|
||||
return c.sort_options()
|
||||
Loading…
x
Reference in New Issue
Block a user