本文整理汇总了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')
示例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()
示例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)
示例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")
示例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)
示例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')