本文整理汇总了Python中webnotes.model.doc.Document.owner方法的典型用法代码示例。如果您正苦于以下问题:Python Document.owner方法的具体用法?Python Document.owner怎么用?Python Document.owner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webnotes.model.doc.Document
的用法示例。
在下文中一共展示了Document.owner方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addchild
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import owner [as 别名]
def addchild(self, fieldname, childtype = '', doclist=None):
"""
Returns a child record of the give `childtype`.
* if local is set, it does not save the record
* if doclist is passed, it append the record to the doclist
"""
from webnotes.model.doc import Document
d = Document()
d.parent = self.name
d.parenttype = self.doctype
d.parentfield = fieldname
d.doctype = childtype
d.docstatus = 0;
d.name = ''
d.owner = webnotes.session['user']
d.fields['__islocal'] = 1 # for Client to identify unsaved doc
if doclist != None:
doclist.append(d)
if doclist:
d.idx = max([(d.idx or 0) for d in doclist if d.doctype==childtype]) + 1
return d
示例2: post_comment
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import owner [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')
示例3: add
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import owner [as 别名]
def add():
"""add in someone's to do list"""
if webnotes.conn.sql("""select owner from `tabToDo Item`
where reference_type=%(doctype)s and reference_name=%(name)s
and owner=%(assign_to)s""", webnotes.form_dict):
webnotes.msgprint("Already in todo")
return
else:
from webnotes.model.doc import Document
from webnotes.utils import nowdate
d = Document("ToDo Item")
d.owner = webnotes.form_dict['assign_to']
d.reference_type = webnotes.form_dict['doctype']
d.reference_name = webnotes.form_dict['name']
d.description = webnotes.form_dict['description']
d.priority = webnotes.form_dict.get('priority', 'Medium')
d.date = webnotes.form_dict.get('date', nowdate())
d.assigned_by = webnotes.user.name
d.save(1)
# notify
notify_assignment(d.assigned_by, d.owner, d.reference_type, d.reference_name, action='ASSIGN', notify=webnotes.form_dict.get('notify'))
# update feeed
try:
import home
from webnotes.utils import get_fullname
home.make_feed('Assignment', d.reference_type, d.reference_name, webnotes.session['user'],
'[%s] Assigned to %s' % (d.priority, get_fullname(d.owner)), '#C78F58')
except ImportError, e:
pass
示例4: create_profile
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import owner [as 别名]
def create_profile(usr, name):
d = Document("Profile")
d.owner = "Administrator"
d.email = usr
d.first_name = name
d.enabled = 1
d.creation = nowdate() + ' ' + nowtime()
d.user_type = "System User"
d.save(1)
示例5: create_todo_preparation
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import owner [as 别名]
def create_todo_preparation(self, parent, tester, test_name):
# webnotes.errprint("in create to do test preparation")
d = Document("ToDo")
d.owner = webnotes.conn.get_value("Employee",tester,'user_id')
d.reference_type = 'Neutralization Value' if test_name == 'Neutralization Value' else 'Test Preparation'
d.reference_name = parent
d.priority = 'Medium'
d.date = nowdate()
d.assigned_by = webnotes.user.name
d.save(1)
示例6: create_todo
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import owner [as 别名]
def create_todo(self, sample, test_id):
user = webnotes.conn.sql("select user_id from tabEmployee where name = '%s'"%(sample.get("tester")),as_list=1)
if user:
d = Document("ToDo")
d.owner = user[0][0]
d.reference_type = sample.get("test")
d.reference_name = test_id
d.priority = 'Medium'
d.date = nowdate()
d.assigned_by = webnotes.user.name
d.save(1)
示例7: make_follower
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import owner [as 别名]
def make_follower(dt, dn, user, verbose):
"Add the user as a follower"
if has_permission(dt, user):
from webnotes.model.doc import Document
d = Document('Follower')
d.doc_type = dt
d.doc_name = dn
d.owner = user
d.save(1)
else:
if verbose: webnotes.msgprint('%s does not have sufficient permission to follow' % user)
示例8: add_calendar_event
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import owner [as 别名]
def add_calendar_event(self):
""" Add calendar event for task in calendar of Allocated person"""
event = Document('Event')
event.owner = self.doc.allocated_to
event.description = self.doc.name
event.event_date = self.doc.exp_start_date and self.doc.exp_start_date or ''
event.event_hour = self.doc.event_hour and self.doc.event_hour or '10:00'
event.event_type = 'Private'
event.ref_type = 'Task'
event.ref_name = self.doc.name
event.save(1)
示例9: assign_to
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import owner [as 别名]
def assign_to(session_userid,test_details):
from webnotes.utils import get_first_day, get_last_day, add_to_date, nowdate, getdate
today = nowdate()
d = Document("ToDo")
d.owner = session_userid[0][0]
d.reference_type = test_details.get("test")
d.reference_name = test_details.get("name")
d.priority = 'Medium'
d.date = today
d.assigned_by = webnotes.user.name
d.save(1)
示例10: add_calender_event
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import owner [as 别名]
def add_calender_event(self,scheduled_date,incharge_email,item_code):
""" Add calendar event for Maintenece Schedule in calendar of Allocated person"""
event = Document('Event')
event.owner = incharge_email
event.description = "Reference:%s, Item Code:%s and Customer: %s" %(self.doc.name, item_code, self.doc.customer)
event.event_date = scheduled_date
event.event_hour = '10:00'
event.event_type = 'Private'
event.ref_type = 'Maintenance Schedule'
event.ref_name = self.doc.name
event.save(1)
示例11: add_todo_item
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import owner [as 别名]
def add_todo_item(self,args):
args = json.loads(args)
d = Document('ToDo Item', args.get('name') or None)
d.description = args['description']
d.date = args['date']
d.priority = args['priority']
d.checked = args.get('checked', 0)
d.owner = session['user']
d.save(not args.get('name') and 1 or 0)
return d.name
示例12: assign_to
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import owner [as 别名]
def assign_to(self,owner):
from webnotes.utils import get_first_day, get_last_day, add_to_date, nowdate, getdate
#webnotes.errprint(owner)
today = nowdate()
d = Document("ToDo")
d.owner = owner
d.reference_type = "Stock Entry"
d.reference_name = self.doc.name
d.priority = 'Medium'
d.date = today
d.assigned_by = webnotes.user.name
d.save(1)
示例13: create_todo
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import owner [as 别名]
def create_todo(self, sample, test_name, test_id):
# webnotes.errprint("in create to do")
userid = webnotes.conn.sql("select user_id from tabEmployee where name = '%s'"%(self.doc.tester),as_list=1)
# webnotes.errprint([userid , sample, sample.get("tester")])
if userid:
d = Document("ToDo")
d.owner = userid[0][0]
d.reference_type = test_name
d.reference_name = test_id
d.priority = 'Medium'
d.date = nowdate()
d.assigned_by = webnotes.user.name
d.save(1)
示例14: send
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import owner [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.")
示例15: edit
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import owner [as 别名]
def edit(arg=None):
args = webnotes.form_dict
d = Document('ToDo', args.get('name') or None)
d.description = args['description']
d.date = args['date']
d.priority = args['priority']
d.checked = args.get('checked', 0)
d.owner = webnotes.session['user']
d.save(not args.get('name') and 1 or 0)
if args.get('name') and d.checked:
notify_assignment(d)
return d.name