当前位置: 首页>>代码示例>>Python>>正文


Python Document.subject方法代码示例

本文整理汇总了Python中webnotes.model.doc.Document.subject方法的典型用法代码示例。如果您正苦于以下问题:Python Document.subject方法的具体用法?Python Document.subject怎么用?Python Document.subject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在webnotes.model.doc.Document的用法示例。


在下文中一共展示了Document.subject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: sync_google_event

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import subject [as 别名]
def sync_google_event(_type='Post'):
        page_token = None
        credentials_json= webnotes.conn.sql(""" select credentails from tabProfile 
                where name ='%s'"""%(webnotes.session.user), as_list=1)
        service = create_service(credentials_json[0][0])
        while True:
                events = service.events().list(calendarId='primary', pageToken=page_token).execute()
                for event in events['items']:
                        eventlist=webnotes.conn.sql("select event_id from `tabEvent`", as_list=1)
                        s= webnotes.conn.sql("select modified from `tabEvent` where event_id= %s ",(event['id']) , as_list=1)
                        a=[]
                        a.append(event['id'])
                        m=[]
                        m.append(event['updated'])
                        if a not in eventlist:
                                webnotes.errprint("created vent")
                                d = Document("Event")
                                d.event_id=event['id']
                                d.subject=event['summary']
                                d.starts_on=event['start']['dateTime']
                                d.ends_on=event['end']['dateTime']
                                d.save()
                                webnotes.errprint(d.name)
                        elif m > s:
                                r=webnotes.conn.sql("update `tabEvent` set starts_on=%s, ends_on=%s,subject=%s where event_id=%s",(event['start']['dateTime'],event['end']['dateTime'],event['summary'],event['id']))
                                webnotes.errprint(event['id'])
                        else:
                                pass
                page_token = events.get('nextPageToken')
                if not page_tok:
			break
开发者ID:gangadhar-kadam,项目名称:nassimlib,代码行数:33,代码来源:event-mod.py

示例2: send_message

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import subject [as 别名]
def send_message():
	from webnotes.model.doc import Document
	args = webnotes.form_dict
	
	d = Document('Support Ticket')
	d.subject = webnotes.form_dict.get('subject', 'Website Query')
	d.description = webnotes.form_dict.get('message')
	d.raised_by = webnotes.form_dict.get('sender')
	
	if not d.description:
		webnotes.response["message"] = 'Please write something'
		return
		
	if not d.raised_by:
		webnotes.response["message"] = 'Email Id Required'
		return
	
	# guest method, cap max writes per hour
	if webnotes.conn.sql("""select count(*) from `tabSupport Ticket`
		where TIMEDIFF(NOW(), modified) < '01:00:00'""")[0][0] > max_tickets_per_hour:
		webnotes.response["message"] = "Sorry: we believe we have received an unreasonably high number of requests of this kind. Please try later"
		return
	
	d.save()
	webnotes.response["message"] = 'Thank You'
开发者ID:MrTomato8,项目名称:erpnext,代码行数:27,代码来源:__init__.py

示例3: make_feed

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import subject [as 别名]
def make_feed(doc, subject, color):
	"makes a new Feed record"
	#msgprint(subject)
	from webnotes.model.doc import Document
	webnotes.conn.sql("delete from tabFeed where doc_type=%s and doc_name=%s", (doc.doctype, doc.name))
	f = Document('Feed')
	f.doc_type = doc.doctype
	f.doc_name = doc.name
	f.subject = subject
	f.color = color
	f.save(1)
开发者ID:Morphnus-IT-Solutions,项目名称:trimos,代码行数:13,代码来源:__init__.py

示例4: send

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import subject [as 别名]
def send(args):
    """create support ticket"""
    args = json.loads(args)

    from webnotes.model.doc import Document

    d = Document("Support Ticket")
    d.raised_by = args["email"]
    d.description = "From: " + args["name"] + "\n\n" + args["message"]
    d.subject = "Website Query"
    d.status = "Open"
    d.owner = "Guest"
    d.save(1)
    webnotes.msgprint("Thank you for your query. We will respond as soon as we can.")
开发者ID:nijil,项目名称:erpnext,代码行数:16,代码来源:contact.py

示例5: sync_google_event

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import subject [as 别名]
def sync_google_event(_type='Post'):
	#webnotes.errprint("google sync")
	page_token = None
	credentials_json= webnotes.conn.sql(""" select credentails from tabProfile 
		where name ='[email protected]'""", as_list=1)
	#webnotes.errprint(credentials_json)
	service = create_service(credentials_json[0][0])
	#ebnotes.errprint("service created")
	while True:
		events = service.events().list(calendarId='primary', pageToken=page_token).execute()
		#webnotes.errprint(events)
		for event in events['items']:
			#ebnotes.errprint("----google events---")
			#ebnotes.errprint(event)
			eventlist=webnotes.conn.sql("select event_id from `tabEvent`", as_list=1)
			#ebnotes.errprint("--eventist --")
			#ebnotes.errprint(eventlist)
			s= webnotes.conn.sql("select modified from `tabEvent` where event_id= %s ",(event['id']) , as_list=1)
			a=[]
			a.append(event['id'])
			m=[]
			m.append(event['updated'])
			#webnotes.errprint(a)
			#webnotes.errprint(m)
			from webnotes.model.doc import Document
			#webnotes.errprint("-----eventdatime----")
			#webnotes.errprint(event['start'])
			if a not in eventlist:
				#webnotes.errprint("good")
				d = Document("Event")
				d.event_id=event['id']
				d.subject=event['summary']
				d.starts_on=event['start']['dateTime']
				d.ends_on=event['end']['dateTime']
				d.save(new=1)
				#webnotes.errprint(event['summary'])
			elif m > s:
				#webnotes.errprint("elif")
				r=webnotes.conn.sql("update `tabEvent` set starts_on=%s, ends_on=%s,subject=%s where event_id=%s",(event['start']['dateTime'],event['end']['dateTime'],event['summary'],event['id']),debug=1)
				#webnotes.errprint("Event Updated...")
				#webnotes.errprint(event['summary'])
			#else:
				#webnotes.errprint("else")

		page_token = events.get('nextPageToken')
		if not page_token:
			break
开发者ID:gangadhar-kadam,项目名称:prjlib,代码行数:49,代码来源:event.py

示例6: send_message

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import subject [as 别名]
def send_message():
	from webnotes.model.doc import Document
	args = webnotes.form_dict
	
	d = Document('Support Ticket')
	d.subject = webnotes.form_dict.get('subject', 'Website Query')
	d.description = webnotes.form_dict.get('message')
	d.raised_by = webnotes.form_dict.get('sender')
	
	if not d.description:
		webnotes.msgprint('Please write something', raise_exception=True)
		
	if not d.raised_by:
		webnotes.msgprint('Please give us your email id so that we can write back to you', raise_exception=True)
	
	d.save()
	webnotes.msgprint('Thank you!')
开发者ID:NorrWing,项目名称:erpnext,代码行数:19,代码来源:__init__.py

示例7: get_support_ticket

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import subject [as 别名]
def get_support_ticket(code,sender_no,message,_type='POST'):
	#return "hello"
	from webnotes.utils import get_first_day, get_last_day, add_to_date, nowdate, getdate
	today = nowdate()
        from webnotes.model.doc import Document
	import time
	#return sender_no[-11:]
	if code[1:-1] =="CRT":
		#return "hello"
		#return sender_no[1:-1]
		msg="Dear Customer,According to your request ticket is created"
	        d= Document('Support Ticket')
		d.opening_time=time.strftime("%H:%M:%S")
		d.opening_date=today
        	d.subject=message[1:-1]
        	d.raised_by=sender_no[1:-1]
		d.company='medsynaptic'
		d.status='Open'
        	d.save()
        	webnotes.conn.commit()
		#p=send_sms(message[1:-1],sender_no1[1:-1])
        	return d.name

	elif code[1:-1]=="CLS":
		#return "hii"
		#msg="Ticket Closed"
		#sender_no1=sender_no[-11:]
		z="select name from `tabSupport Ticket` where raised_by="+sender_no[1:-1]+" and status='Open'"
		x=webnotes.conn.sql(z)
		#return x 
		msg="Dear Customer,according to your request respective ticket is closed"
		if x:

			g="update `tabSupport Ticket` set status='Closed' where name='%s'"%(x[0][0])
			h=webnotes.conn.sql(g)
			#e=send_sms(message[1:-1],sender_no1[1:-1])
			return "Updated" 
			 

		else:
			pass

	else:
		pass
开发者ID:Tejal011089,项目名称:Medsyn2_app,代码行数:46,代码来源:__init__.py

示例8: make_event

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import subject [as 别名]
 def make_event(self,name_slot):
         evnt = Document('Event')
         evnt.slot=name_slot
         evnt.event_type = 'Waiting'
         evnt.starts_on = self.doc.encounter_date + ' ' +self.doc.start_time
         evnt.ends_on = self.doc.encounter_date + ' ' +self.doc.end_time
         if cint(self.doc.new_user)==1:
                 evnt.patient = self.doc.new_patient
                 evnt.patient_name= self.doc.first_name + ' ' + self.doc.last_name
         else:
                 evnt.patient = self.doc.patient
                 evnt.patient_name= self.doc.patient_name
         evnt.service = self.doc.study
         evnt.subject = self.doc.study
         evnt.modality=self.doc.encounter
         evnt.study=self.doc.study
         evnt.save()
         self.doc.eventid = evnt.name
         self.doc.save()
开发者ID:saurabh6790,项目名称:alert-med-app,代码行数:21,代码来源:patient_encounter_entry.py

示例9: process_message

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import subject [as 别名]
	def process_message(self, mail):
		"""
			Updates message from support email as either new or reply
		"""
		from home import update_feed

		content, content_type = '[Blank Email]', 'text/plain'
		if mail.text_content:
			content, content_type = mail.text_content, 'text/plain'
		else:
			content, content_type = mail.html_content, 'text/html'
			
		thread_id = mail.get_thread_id()

		if webnotes.conn.exists('Support Ticket', thread_id):
			from webnotes.model.code import get_obj
			
			st = get_obj('Support Ticket', thread_id)
			st.make_response_record(content, mail.mail['From'], content_type)
			webnotes.conn.set(st.doc, 'status', 'Open')
			update_feed(st.doc)
			return
				
		# new ticket
		from webnotes.model.doc import Document
		d = Document('Support Ticket')
		d.description = content
		d.subject = mail.mail['Subject']
		d.raised_by = mail.mail['From']
		d.content_type = content_type
		d.status = 'Open'
		try:
			d.save(1)
			# update feed
			update_feed(d)

			# send auto reply
			self.send_auto_reply(d)

		except:
			d.description = 'Unable to extract message'
			d.save(1)
开发者ID:tobrahma,项目名称:erpnext,代码行数:44,代码来源:__init__.py

示例10: get_leadcomm_detail

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import subject [as 别名]
	def get_leadcomm_detail(self):
		check_communication_exist=webnotes.conn.sql("select name from `tabCommunication` where parent='%s'"%(self.doc.name))
		if not check_communication_exist:
			if self.doc.lead:
				res=webnotes.conn.sql("select name from `tabCommunication` where parent='%s'"%(self.doc.lead))
				for name in res:
					#webnotes.errprint(name)
				 	content=webnotes.conn.sql("select * from `tabCommunication` where name='%s'"%(name[0]),as_dict=1)
					if content:
						for data in content:
							d=Document('Communication')
							d.content=data.content
							d.parent=self.doc.name
							d.parenttype='Opportunity'
							d.idx=data.idx
							d.docstatus=data.docstatus
							d.parentfield=data.parentfield
							d.sender=data.sender
							d.recipients=data.recipients
							d.sent_or_received=data.sent_or_received
							d.communication_medium=data.communication_medium
							d.subject=data.subject
							d.save()
开发者ID:gangadhar-kadam,项目名称:prjapp,代码行数:25,代码来源:opportunity.py

示例11: process_message

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import subject [as 别名]
    def process_message(self, mail):
        """
			Updates message from support email as either new or reply
		"""
        from home import update_feed

        content, content_type = "[Blank Email]", "text/plain"
        if mail.text_content:
            content, content_type = mail.text_content, "text/plain"
        else:
            content, content_type = mail.html_content, "text/html"

        thread_list = mail.get_thread_id()

        email_id = mail.mail["From"]
        if "<" in mail.mail["From"]:
            import re

            re_result = re.findall("(?<=\<)(\S+)(?=\>)", mail.mail["From"])
            if re_result and re_result[0]:
                email_id = re_result[0]

        from webnotes.utils import decode_email_header

        full_email_id = decode_email_header(mail.mail["From"])

        for thread_id in thread_list:
            exists = webnotes.conn.sql(
                """\
				SELECT name
				FROM `tabSupport Ticket`
				WHERE name=%s AND raised_by REGEXP %s
				""",
                (thread_id, "(" + email_id + ")"),
            )
            if exists and exists[0] and exists[0][0]:
                st = webnotes.get_obj("Support Ticket", thread_id)

                from core.doctype.communication.communication import make

                make(
                    content=content,
                    sender=full_email_id,
                    doctype="Support Ticket",
                    name=thread_id,
                    lead=st.doc.lead,
                    contact=st.doc.contact,
                )

                st.doc.status = "Open"
                st.doc.save()

                update_feed(st, "on_update")
                # extract attachments
                self.save_attachments(st.doc, mail.attachments)
                return

        from webnotes.model.doctype import get_property

        opts = get_property("Support Ticket", "options", "naming_series")
        # new ticket
        from webnotes.model.doc import Document

        d = Document("Support Ticket")
        d.description = content

        d.subject = decode_email_header(mail.mail["Subject"])

        d.raised_by = full_email_id
        d.content_type = content_type
        d.status = "Open"
        d.naming_series = opts and opts.split("\n")[0] or "SUP"
        try:
            d.save(1)
            try:
                # extract attachments
                self.save_attachments(d, mail.attachments)
            except Exception, e:
                self.description += "\n\n[Did not pull attachment]"
        except:
            d.description = "Unable to extract message"
            d.save(1)
        else:
            # send auto reply
            if cint(self.email_settings.send_autoreply):
                if "mailer-daemon" not in d.raised_by.lower():
                    self.send_auto_reply(d)
开发者ID:arunemmanuel,项目名称:erpnext,代码行数:89,代码来源:__init__.py

示例12: get_customer_issue

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import subject [as 别名]
def get_customer_issue(installationname,sender_no,message,_type='POST'):
		#return installationname[1:-1]
		#sender_no1=sender_no[-11:]
		
		qr="select customer,employee_id from `tabInstallation Note` where name='"+installationname[1:-1]+"' "
        	res=webnotes.conn.sql(qr)
        	#return qr
		x="select customer_name from `tabCustomer` where customer_no='"+sender_no[1:-1]+"' "
		y=webnotes.conn.sql(x)
		#return x
		if y == None:
		
			z="select user_id from `tabEmployee` where cell_number="+sender_no[1:-1]+""	
			m=webnotes.conn.sql(z)
			#return m
		w="select status,user_id from `tabEmployee` where name='%s'"%(res[0][1]);
		t=webnotes.conn.sql(w)
		#return t
		from webnotes.utils import get_first_day, get_last_day, add_to_date, nowdate, getdate
		today = nowdate()
		qry="select name from `tabFiscal Year` where is_fiscal_year_closed='No'"
        	res1=webnotes.conn.sql(qry)
	
		q=" select territory from `tabCustomer` where name='%s'"%(res[0][0]);

		r=webnotes.conn.sql(q)	
	 	w=" select parent from `tabDefaultValue` where  defkey = '%s' and defvalue = '%s'"%('territory',r[0][0])
		a=webnotes.conn.sql(w)
		#return a
		from webnotes.model.doc import Document
		import time
	
    		#if res :
        	d = Document('Support Ticket')
		d.opening_time=time.strftime("%H:%M:%S")
		if y:
			d.raised_by=y[0][0]
		elif z:
			d.raised_by=z[0][0]
		else:
			d.raised_by=sender_no1[-11:]
        	d.subject=installationname[1:-1]
		d.customer_name=res[0][0]
		d.customer=res[0][0]
		d.territory=r[0][0]
		d.status='Open'
		#d.customer_group='Individual'
		d.opening_date=today
        	#d.fiscal_year=res1[0][0]
        	d.company='medsynaptic'
        	d.territory=r[0][0]
		#d.raised_by=res[0][1]
		if t[0][0] =='Active':
			#return t[0][1]
			d.assigned_to=t[0][1]
			d.assigned_to_higher_level=a[0][0]
		else:
			d.assigned_to=a[0][0]
			d.assigned_to_higher_level=a[0][0]
		
		#d.assigned_to_higher_level=a[0][0]
        	#return d.fiscal_year
        	d.save()
        	webnotes.conn.commit()
		#return sender_no[1:-1]
		p=send_sms(message[1:-1],sender_no[1:-1])

        	return d.name   
开发者ID:Tejal011089,项目名称:Medsyn2_app,代码行数:70,代码来源:__init__.py

示例13: process_message

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import subject [as 别名]
	def process_message(self, mail):
		"""
			Updates message from support email as either new or reply
		"""
		from home import update_feed

		content, content_type = '[Blank Email]', 'text/plain'
		if mail.text_content:
			content, content_type = mail.text_content, 'text/plain'
		else:
			content, content_type = mail.html_content, 'text/html'
			
		thread_list = mail.get_thread_id()


		email_id = mail.mail['From']
		if "<" in mail.mail['From']:
			import re
			re_result = re.findall('(?<=\<)(\S+)(?=\>)', mail.mail['From'])
			if re_result and re_result[0]: email_id = re_result[0]


		for thread_id in thread_list:
			exists = webnotes.conn.sql("""\
				SELECT name
				FROM `tabSupport Ticket`
				WHERE name=%s AND raised_by REGEXP %s
				""" , (thread_id, '(' + email_id + ')'))
			if exists and exists[0] and exists[0][0]:
				from webnotes.model.code import get_obj
				
				st = get_obj('Support Ticket', thread_id)
				st.make_response_record(content, mail.mail['From'], content_type)
				webnotes.conn.set(st.doc, 'status', 'Open')
				update_feed(st.doc)
				# extract attachments
				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')
		d.description = content
		d.subject = mail.mail['Subject']
		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)

			# update feed
			update_feed(d)

			# send auto reply
			self.send_auto_reply(d)

		except:
			d.description = 'Unable to extract message'
			d.save(1)

		else:
			# extract attachments
			self.save_attachments(d, mail.attachments)
开发者ID:calvinfroedge,项目名称:erpnext,代码行数:69,代码来源:__init__.py

示例14: add_support_communication

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import subject [as 别名]
def add_support_communication(subject, content, sender, docname=None, mail=None):
	print "get suport com fun 2"
	qr="select customer,employee_id from `tabInstallation Note` where product_barcode='"+subject+"'"
	print qr
        res=webnotes.conn.sql(qr)
        print res
	'''
        w="select status,user_id from `tabEmployee` where name='%s'"%(res[0][1]);
	print w
        t=webnotes.conn.sql(w)
	print t
	q=" select territory from `tabCustomer` where name='%s'"%(res[0][0]);
 	print q
        r=webnotes.conn.sql(q)
	print r
       	w=" select parent from `tabDefaultValue` where  defkey = '%s' and defvalue = '%s'"%('territory',r[0][0])
        print w
	a=webnotes.conn.sql(w)
	print a
	if t[0][0] != 'Left':
		assigned_to=t[0][1]
		assigned_to_higher_level=a[0][0]
	else:
		assigned_to=a[0][0]
		assigned_to_higher_level=a[0][0]
		
	print "if else end"
	'''
	if docname:
		print "if"
		ticket = webnotes.bean("Support Ticket", docname)
		ticket.doc.status = 'Open'
		ticket.ignore_permissions = True
		ticket.doc.save()
		webnotes.conn.commit()
	else:
		print "else"
		assigned_to= None
		assigned_to_higher_level= None
		#print subject
		qr="select customer,employee_id from `tabInstallation Note` where product_barcode='%s'"%(subject);
        	res=webnotes.conn.sql(qr)
        	#print res
        	if res:
        		w="select status,user_id from `tabEmployee` where name='%s'"%(res[0][1]);
        		t=webnotes.conn.sql(w)
        		#print t
        		q=" select territory,customer_name from `tabCustomer` where name='%s'"%(res[0][0]);
        		r=webnotes.conn.sql(q)
        		#print r
        		if r:
        				w=" select parent from `tabDefaultValue` where  defkey = '%s' and defvalue = '%s'"%('territory',r[0][0])
       					a=webnotes.conn.sql(w)
       					#print a
       			if t[0][0] == 'Left':
				assigned_to=a[0][0]
                                assigned_to_higher_level=a[0][0]
				
			else:
                                assigned_to=t[0][1]
                                assigned_to_higher_level=a[0][0]
                from webnotes.model.doc import Document
        	a= Document('Support Ticket')
        	a.subject=subject
        	a.raised_by=sender
        	a.description=content
		a.territory=r[0][0]
        	a.customer=res[0][0]
		a.customer_name=r[0][1]
        	a.assigned_to_higher_level=assigned_to_higher_level
        	a.assigned_to=assigned_to
        	a.status='Open'
        	a.save(new=1)
		webnotes.conn.commit()
    	return a		
开发者ID:Tejal011089,项目名称:med2-app,代码行数:77,代码来源:get_support_mails.py

示例15: process_message

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import subject [as 别名]
	def process_message(self, mail):
		"""
			Updates message from support email as either new or reply
		"""
		from home import update_feed

		content, content_type = '[Blank Email]', 'text/plain'
		if mail.text_content:
			content, content_type = mail.text_content, 'text/plain'
		else:
			content, content_type = mail.html_content, 'text/html'
			
		thread_list = mail.get_thread_id()


		email_id = mail.mail['From']
		if "<" in mail.mail['From']:
			import re
			re_result = re.findall('(?<=\<)(\S+)(?=\>)', mail.mail['From'])
			if re_result and re_result[0]: email_id = re_result[0]
		
		from webnotes.utils import decode_email_header
		
		full_email_id = decode_email_header(mail.mail['From'])

		for thread_id in thread_list:
			exists = webnotes.conn.sql("""\
				SELECT name
				FROM `tabSupport Ticket`
				WHERE name=%s AND raised_by REGEXP %s
				""" , (thread_id, '(' + email_id + ')'))
			if exists and exists[0] and exists[0][0]:
				from webnotes.model.code import get_obj
				
				st = get_obj('Support Ticket', thread_id)
				st.make_response_record(content, full_email_id, content_type)
				
				# to update modified date
				#webnotes.conn.set(st.doc, 'status', 'Open')
				st.doc.status = 'Open'
				st.doc.save()
				
				update_feed(st.doc, 'on_update')
				webnotes.conn.commit()
				# extract attachments
				self.save_attachments(st.doc, mail.attachments)
				webnotes.conn.begin()
				return
				
		from webnotes.model.doctype import get_property
		opts = get_property('Support Ticket', 'options', 'naming_series')
		# new ticket
		from webnotes.model.doc import Document
		d = Document('Support Ticket')
		d.description = content
		
		d.subject = decode_email_header(mail.mail['Subject'])
		
		d.raised_by = full_email_id
		d.content_type = content_type
		d.status = 'Open'
		d.naming_series = opts and opts.split("\n")[0] or 'SUP'
		try:
			d.save(1)
		except:
			d.description = 'Unable to extract message'
			d.save(1)

		else:
			# update feed
			update_feed(d, 'on_update')

			# send auto reply
			if cint(self.email_settings.send_autoreply):
				self.send_auto_reply(d)

			webnotes.conn.commit()
			# extract attachments
			self.save_attachments(d, mail.attachments)
			webnotes.conn.begin()
开发者ID:smilekk,项目名称:erpnext,代码行数:82,代码来源:__init__.py


注:本文中的webnotes.model.doc.Document.subject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。