diff --git a/helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.json b/helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.json index 4950fc5c4..de3c8c8fd 100644 --- a/helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.json +++ b/helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.json @@ -368,7 +368,7 @@ "icon": "fa fa-issue", "idx": 61, "links": [], - "modified": "2023-09-27 02:51:13.078952", + "modified": "2023-09-27 03:20:19.360900", "modified_by": "Administrator", "module": "Helpdesk", "name": "HD Ticket", @@ -401,7 +401,6 @@ }, { "create": 1, - "delete": 1, "email": 1, "export": 1, "if_owner": 1, @@ -409,8 +408,7 @@ "read": 1, "report": 1, "role": "All", - "share": 1, - "write": 1 + "share": 1 } ], "quick_entry": 1, @@ -424,4 +422,4 @@ "title_field": "subject", "track_changes": 1, "track_seen": 1 -} \ No newline at end of file +} diff --git a/helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py b/helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py index 2c31bb61b..8e33f791d 100644 --- a/helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py +++ b/helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py @@ -148,6 +148,16 @@ def by_priority(query: Query, direction: Order): "Last modified on": "modified", } + def has_permission(self, perm): + has_standard_permissions = super().has_permission(perm) + user = frappe.session.user + customer = get_customer(user) + is_customer = self.customer == customer + is_contact = self.contact == user + is_raised = self.raised_by == user + has_extra_permissions = is_customer or is_contact or is_raised + return has_standard_permissions or has_extra_permissions + def publish_update(self): publish_event("helpdesk:ticket-update", {"name": self.name}) capture_event("ticket_updated")