本文整理汇总了Python中webnotes.model.doc.Document.fields[d]方法的典型用法代码示例。如果您正苦于以下问题:Python Document.fields[d]方法的具体用法?Python Document.fields[d]怎么用?Python Document.fields[d]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webnotes.model.doc.Document
的用法示例。
在下文中一共展示了Document.fields[d]方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_acc
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import fields[d] [as 别名]
def add_acc(self,lst):
ac = Document('Account')
for d in self.fld_dict.keys():
ac.fields[d] = (d == 'parent_account' and lst[self.fld_dict[d]]) and lst[self.fld_dict[d]] +' - '+ self.doc.abbr or lst[self.fld_dict[d]]
ac_obj = get_obj(doc=ac)
ac_obj.doc.freeze_account='No'
ac_obj.doc.master_type = ''
ac_obj.validate()
ac_obj.doc.save(1)
ac_obj.on_update()
示例2: add_acc
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import fields[d] [as 别名]
def add_acc(self,lst):
ac = Document('Account')
for d in self.fld_dict.keys():
ac.fields[d] = (d == 'parent_account' and lst[self.fld_dict[d]]) and lst[self.fld_dict[d]] +' - '+ self.doc.abbr or lst[self.fld_dict[d]]
ac.old_parent = ''
ac_obj = get_obj(doc=ac)
ac_obj.validate()
ac_obj.doc.save(1)
ac_obj.on_update()
sql("commit")
sql("start transaction")
示例3: add_ac
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import fields[d] [as 别名]
def add_ac(self,arg):
arg = eval(arg)
ac = Document('Account')
for d in arg.keys():
ac.fields[d] = arg[d]
ac.old_parent = ''
ac_obj = get_obj(doc=ac)
ac_obj.validate()
ac_obj.doc.save(1)
ac_obj.on_update()
return ac_obj.doc.name
示例4: add_acc
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import fields[d] [as 别名]
def add_acc(self, lst):
ac = Document("Account")
for d in self.fld_dict.keys():
ac.fields[d] = (
(d == "parent_account" and lst[self.fld_dict[d]])
and lst[self.fld_dict[d]] + " - " + self.doc.abbr
or lst[self.fld_dict[d]]
)
ac_obj = get_obj(doc=ac)
ac_obj.doc.freeze_account = "No"
ac_obj.doc.master_type = ""
ac_obj.validate()
ac_obj.doc.save(1)
ac_obj.on_update()
示例5: add_cc
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import fields[d] [as 别名]
def add_cc(self,arg):
arg = eval(arg)
cc = Document('Cost Center')
# map fields
for d in arg.keys():
cc.fields[d] = arg[d]
# map company abbr
other_info = webnotes.conn.sql("select company_abbr from `tabCost Center` where name='%s'"%arg['parent_cost_center'])
cc.company_abbr = other_info and other_info[0][0] or arg['company_abbr']
cc_obj = get_obj(doc=cc)
cc_obj.validate()
cc_obj.doc.save(1)
cc_obj.on_update()
return cc_obj.doc.name
示例6: add_node
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import fields[d] [as 别名]
def add_node(self,arg):
arg = eval(arg)
node_title = arg['node_title']
n = Document(node_title)
for d in arg.keys():
if d != 'node_title':
n.fields[d]=arg[d]
n.old_parent = ''
n_obj = get_obj(doc=n)
n_obj.validate()
n_obj.doc.save(1)
n_obj.on_update()
return n_obj.doc.name
示例7: add_profile
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import fields[d] [as 别名]
def add_profile(self,arg):
# Check credit balance
get_obj('WN ERP Client Control').check_credit_balance()
arg=eval(arg)
pr=Document('Profile')
for d in arg.keys():
if d!='role':
pr.fields[d] = arg[d]
pr.enabled=0
pr.user_type='System User'
pr.save(1)
pr_obj = get_obj('Profile',pr.name)
if (pr.name):
msg="New member is added"
pr_obj.on_update()
else:
msg="Profile not created"
return cstr(msg)