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


Python Document.comment_doctype方法代码示例

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


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

示例1: post_comment

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import comment_doctype [as 别名]
def post_comment(arg):
	arg = load_json(arg)
	
	from webnotes.model.doc import Document
	d = Document('Comment Widget Record')
	d.comment_doctype = 'My Company'
	d.comment_docname = arg['uid'] # to
	d.owner = webnotes.user.name
	d.comment = arg['comment']
	d.save(1)
	
	if cint(arg['notify']):
		fn = webnotes.conn.sql('select first_name, last_name from tabProfile where name=%s', webnotes.user.name)[0]
		if fn[0] or f[1]:
			fn = cstr(fn[0]) + (fn[0] and ' ' or '') + cstr(fn[1])
		else:
			fn = webnotes.user.name

		from webnotes.utils.email_lib import sendmail
		from setup.doctype.notification_control.notification_control import get_formatted_message
		
		message = '''A new comment has been posted on your page by %s:
		
		<b>Comment:</b> %s
		
		To answer, please login to your erpnext account!
		''' % (fn, arg['comment'])
		
		sendmail([arg['uid']], webnotes.user.name, get_formatted_message('New Comment', message), fn + ' has posted a new comment')
开发者ID:Morphnus-IT-Solutions,项目名称:trimos,代码行数:31,代码来源:my_company.py

示例2: post

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import comment_doctype [as 别名]
def post(arg=None):
	"""post message"""
	import json
	arg = json.loads(arg)
	from webnotes.model.doc import Document
	d = Document('Comment Widget Record')
	d.comment = arg['txt']
	d.comment_docname = arg['contact']
	d.comment_doctype = 'Message'
	d.save()
开发者ID:antoxin,项目名称:erpnext,代码行数:12,代码来源:messages.py

示例3: post

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import comment_doctype [as 别名]
def post(arg=None):
	import webnotes
	"""post message"""
	if arg:
		import json
		arg = json.loads(arg)
	else:
		arg = {}
		arg.update(webnotes.form_dict)
	from webnotes.model.doc import Document
	d = Document('Comment')
	d.comment = arg['txt']
	d.comment_docname = arg['contact']
	d.comment_doctype = 'Message'
	d.save()

	import webnotes.utils
	if webnotes.utils.cint(arg.get('notify')):
		notify(arg)
开发者ID:hbkfabio,项目名称:erpnext,代码行数:21,代码来源:messages.py

示例4: post_comment

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import comment_doctype [as 别名]
def post_comment(arg):
    arg = load_json(arg)

    from webnotes.model.doc import Document

    d = Document("Comment Widget Record")
    d.comment_doctype = "My Company"
    d.comment_docname = arg["uid"]  # to
    d.owner = webnotes.user.name
    d.comment = arg["comment"]
    d.save(1)

    if cint(arg.get("notify")):
        fn = webnotes.conn.sql("select first_name, last_name from tabProfile where name=%s", webnotes.user.name)[0]
        if fn[0] or f[1]:
            fn = cstr(fn[0]) + (fn[0] and " " or "") + cstr(fn[1])
        else:
            fn = webnotes.user.name

        message = """A new comment has been posted on your page by %s:
		
		<b>Comment:</b> %s
		
		To answer, please login to your erpnext account!

		<a href='https://signin.erpnext.com'>https://signin.erpnext.com</a>
		""" % (
            fn,
            arg["comment"],
        )

        from webnotes.model.code import get_obj

        note = get_obj("Notification Control")
        email_msg = note.prepare_message({"type": "New Comment", "message": message})

        sender = webnotes.user.name != "Administrator" and webnotes.user.name or "[email protected]"

        from webnotes.utils.email_lib import sendmail

        sendmail([arg["uid"]], sender, email_msg, fn + " has posted a new comment")
开发者ID:antoxin,项目名称:erpnext,代码行数:43,代码来源:my_company.py

示例5: post

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import comment_doctype [as 别名]
def post(arg=None):
	import webnotes
	"""post message"""
	if not arg:
		arg = {}
		arg.update(webnotes.form_dict)
	
	if isinstance(arg, basestring):
		import json
		arg = json.loads(arg)

	from webnotes.model.doc import Document
	d = Document('Comment')
	d.parenttype = arg.get("parenttype")
	d.comment = arg['txt']
	d.comment_docname = arg['contact']
	d.comment_doctype = 'Message'
	d.save()

	import webnotes.utils
	if webnotes.utils.cint(arg.get('notify')):
		notify(arg)
开发者ID:Yellowen,项目名称:wnframework,代码行数:24,代码来源:messages.py

示例6: post_comment

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import comment_doctype [as 别名]
def post_comment(arg):
	arg = load_json(arg)
	
	from webnotes.model.doc import Document
	d = Document('Comment Widget Record')
	d.comment_doctype = 'My Company'
	d.comment_docname = arg['uid'] # to
	d.owner = webnotes.user.name
	d.comment = arg['comment']
	d.save(1)
	
	if cint(arg['notify']):
		fn = webnotes.conn.sql('select first_name, last_name from tabProfile where name=%s', webnotes.user.name)[0]
		if fn[0] or f[1]:
			fn = cstr(fn[0]) + (fn[0] and ' ' or '') + cstr(fn[1])
		else:
			fn = webnotes.user.name

		message = '''A new comment has been posted on your page by %s:
		
		<b>Comment:</b> %s
		
		To answer, please login to your erpnext account!

		<a href='https://signin.erpnext.com'>https://signin.erpnext.com</a>
		''' % (fn, arg['comment'])
		
		from webnotes.model.code import get_obj
		note = get_obj('Notification Control')
		email_msg = note.prepare_message({
			'type': 'New Comment',
			'message': message
		})

		sender = webnotes.user.name!='Administrator' and webnotes.user.name or '[email protected]'
		
		from webnotes.utils.email_lib import sendmail
		sendmail([arg['uid']], sender, email_msg, fn + ' has posted a new comment')
开发者ID:calvinfroedge,项目名称:erpnext,代码行数:40,代码来源:my_company.py


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