[support ticket] clear assign to on closing ticket
diff --git a/support/doctype/support_ticket/support_ticket.js b/support/doctype/support_ticket/support_ticket.js
index 3da81d9..4ee4c1d 100644
--- a/support/doctype/support_ticket/support_ticket.js
+++ b/support/doctype/support_ticket/support_ticket.js
@@ -29,17 +29,13 @@
erpnext.hide_naming_series();
cur_frm.cscript.make_listing(doc);
if(!doc.__islocal) {
- if(in_list(user_roles,'System Manager')) {
- if(doc.status!='Closed') cur_frm.add_custom_button('Close Ticket', cur_frm.cscript['Close Ticket']);
- if(doc.status=='Closed') cur_frm.add_custom_button('Re-Open Ticket', cur_frm.cscript['Re-Open Ticket']);
- }else if(doc.allocated_to) {
- cur_frm.set_df_property('status','read_only', 1);
- if(user==doc.allocated_to && doc.status!='Closed') cur_frm.add_custom_button('Close Ticket', cur_frm.cscript['Close Ticket']);
+ if(user_roles.indexOf("Support Manager")!==-1) {
+ if(doc.status!='Closed') cur_frm.add_custom_button('Close Ticket', cur_frm.cscript['Close Ticket']);
+ if(doc.status=='Closed') cur_frm.add_custom_button('Re-Open Ticket', cur_frm.cscript['Re-Open Ticket']);
}
- cur_frm.set_df_property('subject','read_only', 1);
- cur_frm.set_df_property('description','hidden', 1);
- cur_frm.set_df_property('raised_by','read_only', 1);
+ cur_frm.toggle_enable(["subject", "raised_by"], false);
+ cur_frm.toggle_display("description", false);
}
refresh_field('status');
},
diff --git a/support/doctype/support_ticket/support_ticket.py b/support/doctype/support_ticket/support_ticket.py
index 5625f11..8a705f4 100644
--- a/support/doctype/support_ticket/support_ticket.py
+++ b/support/doctype/support_ticket/support_ticket.py
@@ -45,6 +45,10 @@
def validate(self):
self.update_status()
+ if self.doc.status == "Closed":
+ from webnotes.widgets.form.assign_to import clear
+ clear(self.doc.doctype, self.doc.name)
+
def on_communication_sent(self, comm):
webnotes.conn.set(self.doc, 'status', 'Waiting for Customer')
if comm.lead and not self.doc.lead: