diff --git a/crm/crm/doctype/crm_lead/crm_lead.py b/crm/crm/doctype/crm_lead/crm_lead.py index 74242852..f54ef59b 100644 --- a/crm/crm/doctype/crm_lead/crm_lead.py +++ b/crm/crm/doctype/crm_lead/crm_lead.py @@ -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' }, + ] \ No newline at end of file diff --git a/crm/extends/doc.py b/crm/extends/doc.py new file mode 100644 index 00000000..3d36ff14 --- /dev/null +++ b/crm/extends/doc.py @@ -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() \ No newline at end of file