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


Python Document.raised_by方法代码示例

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


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

示例1: send_message

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import raised_by [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

示例2: send

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import raised_by [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

示例3: send_message

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import raised_by [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

示例4: get_support_ticket

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import raised_by [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

示例5: process_message

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import raised_by [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

示例6: process_message

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import raised_by [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

示例7: process_message

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import raised_by [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

示例8: process_message

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import raised_by [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

示例9: get_customer_issue

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import raised_by [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

示例10: add_support_communication

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import raised_by [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


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