def notify_assignment(assigned_by, owner, doc_type, doc_name, action='CLOSE', notify=0): """ Notify assignee that there is a change in assignment """ if not (assigned_by and owner and doc_type and doc_name): return # Search for email address in description -- i.e. assignee assignment = """<a href="#!Form/%s/%s">%s</a>""" % (doc_type, doc_name, doc_name) if action=='CLOSE': if owner == webnotes.session.get('user'): arg = { 'uid': assigned_by, 'comment': "The task %s, that you assigned to %s, has been \ closed." % (assignment, owner) } else: arg = { 'uid': assigned_by, 'comment': "The task %s, that you assigned to %s, \ has been closed by %s." % (assignment, owner, webnotes.session.get('user')) } else: arg = { 'uid': owner, 'comment': "A new task, %s, has been assigned to you by %s." \ % (assignment, webnotes.session.get('user')), 'notify': notify } from home.page.my_company import my_company my_company.post_comment(arg)
def add_question(arg): args = load_json(arg) from webnotes.model.doc import Document d = Document('Question') d.question = args['question'].title() d.points = 1 d.save(1) if args['suggest']: from home.page.my_company.my_company import post_comment for s in args['suggest']: if s: post_comment({ 'uid': s, 'comment': 'Please help me and answer the question "%s" in the Knowledge Base' % d.question, 'notify': 1 })
def add_question(arg): args = load_json(arg) from webnotes.model.doc import Document d = Document("Question") d.question = args["question"].title() d.points = 1 d.save(1) if args["suggest"]: from home.page.my_company.my_company import post_comment for s in args["suggest"]: if s: post_comment( { "uid": s, "comment": 'Please help me and answer the question "%s" in the Knowledge Base' % d.question, "notify": 1, } )