From 6a13e8b645d030db9f569ceed3c6dfa4ecb2e735 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 5 Jan 2012 19:17:57 +0530 Subject: [PATCH] Apply naming series when saving support ticket for 1st time --- erpnext/support/doctype/support_ticket/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/support/doctype/support_ticket/__init__.py b/erpnext/support/doctype/support_ticket/__init__.py index 0e73cf7782..3b05bda051 100644 --- a/erpnext/support/doctype/support_ticket/__init__.py +++ b/erpnext/support/doctype/support_ticket/__init__.py @@ -67,6 +67,9 @@ class SupportMailbox(POP3Mailbox): self.save_attachments(st.doc, mail.attachments) return + opts = webnotes.conn.sql("""\ + SELECT options FROM tabDocField + WHERE parent='Support Ticket' AND fieldname='naming_series'""") # new ticket from webnotes.model.doc import Document d = Document('Support Ticket') @@ -75,6 +78,7 @@ class SupportMailbox(POP3Mailbox): d.raised_by = mail.mail['From'] d.content_type = content_type d.status = 'Open' + d.naming_series = (opts and opts[0] and opts[0][0] and opts[0][0].split("\n")[0]) or 'SUP' try: d.save(1)