本文整理汇总了Python中webnotes.model.doc.Document.defvalue方法的典型用法代码示例。如果您正苦于以下问题:Python Document.defvalue方法的具体用法?Python Document.defvalue怎么用?Python Document.defvalue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webnotes.model.doc.Document
的用法示例。
在下文中一共展示了Document.defvalue方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: role_match_cond
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import defvalue [as 别名]
def role_match_cond(self):
ur=Document('UserRole')
ur.parent=self.doc.patient_online_id
ur.parentfield='user_roles'
ur.parenttype='Profile'
ur.role='Patient'
ur.save(new=1)
dv=Document('DefaultValue')
dv.parent=self.doc.patient_online_id
dv.parentfield='system_defaults'
dv.parenttype='Control Panel'
dv.defkey='patient'
dv.defvalue=self.doc.name
dv.save(new=1)
dv=Document('DefaultValue')
dv.parent=self.doc.patient_online_id
dv.parentfield='system_defaults'
dv.parenttype='Control Panel'
dv.defkey='patient_id'
dv.defvalue=self.doc.name
dv.save(new=1)
dv=Document("DefaultValue")
dv.parent = self.doc.patient_online_id
dv.parentfield = 'system_defaults'
dv.parenttype = 'Control Panel'
dv.defkey = 'global_id'
dv.defvalue = self.doc.name
dv.save(new=1)
示例2: profile_ceation
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import defvalue [as 别名]
def profile_ceation(self):
webnotes.errprint("creating profile_ceation")
ch=webnotes.conn.sql("select name from tabProfile where name like '%"+cstr(self.doc.contact_email)+"%'")
if ch:
pass
else :
pp=Document('Profile')
pp.email=self.doc.contact_email
pp.first_name=self.doc.contact_name
webnotes.errprint(self.doc.password)
pp.new_password=self.doc.password
pp.account_id=self.doc.name
pp.franchise_admin='1'
pp.enabled='1'
pp.save(new=1)
ur=Document('UserRole')
ur.parent=self.doc.contact_email
ur.parentfield='user_roles'
ur.parenttype='Profile'
ur.role='Franchise'
ur.save(new=1)
dv=Document('DefaultValue')
dv.parent=self.doc.contact_email
dv.parentfield='system_defaults'
dv.parenttype='Control Panel'
dv.defkey='region'
dv.defvalue=self.doc.region
dv.save(new=1)
aa="insert into __Auth(user,password) values('"+self.doc.contact_email+"',password('"+self.doc.password+"'))"
webnotes.errprint(aa)
webnotes.conn.sql(aa)
示例3: set_default_val
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import defvalue [as 别名]
def set_default_val(self,def_keys,def_val,prof_nm):
for d in def_keys:
kv = Document('DefaultValue')
kv.defkey = d
kv.defvalue = def_val
kv.parent = prof_nm
kv.parenttype = 'Profile'
kv.parentfield = 'defaults'
kv.save(1)
示例4: set_default_val
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import defvalue [as 别名]
def set_default_val(self, def_keys, def_val, prof_nm):
for d in def_keys:
kv = Document("DefaultValue")
kv.defkey = d
kv.defvalue = def_val
kv.parent = prof_nm
kv.parenttype = "Profile"
kv.parentfield = "defaults"
kv.save(1)
示例5: role_match_cond
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import defvalue [as 别名]
def role_match_cond(self):
ur = Document("UserRole")
ur.parent = self.doc.patient_online_id
ur.parentfield = "user_roles"
ur.parenttype = "Profile"
ur.role = "Patient"
ur.save(new=1)
dv = Document("DefaultValue")
dv.parent = self.doc.patient_online_id
dv.parentfield = "system_defaults"
dv.parenttype = "Control Panel"
dv.defkey = "patient"
dv.defvalue = self.doc.name
dv.save(new=1)
dv = Document("DefaultValue")
dv.parent = self.doc.patient_online_id
dv.parentfield = "system_defaults"
dv.parenttype = "Control Panel"
dv.defkey = "patient_id"
dv.defvalue = self.doc.name
dv.save(new=1)
示例6: add_default
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import defvalue [as 别名]
def add_default(self, arg):
parent, parenttype, defkey, defvalue = arg.split('~~~')
if sql("select name from tabDefaultValue where parent=%s and defkey=%s and defvalue=%s", (parent, defkey, defvalue)):
msgprint("This rule already exists!")
return
dv = Document('DefaultValue')
dv.parent = parent
dv.parenttype = parenttype
dv.parentfield = 'defaults'
dv.defkey = defkey
dv.defvalue = defvalue
dv.save(1)
return dv.fields
示例7: set_default
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import defvalue [as 别名]
def set_default(key, val):
"""
Set / add a default value to :term:`Control Panel`
"""
res = webnotes.conn.sql('select defkey from `tabDefaultValue` where defkey="%s" and parent = "Control Panel"' % key)
if res:
webnotes.conn.sql('update `tabDefaultValue` set defvalue="%s" where parent = "Control Panel" and defkey="%s"' % (val, key))
else:
from webnotes.model.doc import Document
d = Document('DefaultValue')
d.parent = 'Control Panel'
d.parenttype = 'Control Panel'
d.parentfield = 'system_defaults'
d.defkey = key
d.defvalue = val
d.save(1)
示例8: set_default
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import defvalue [as 别名]
def set_default(self, key, val, parent="Control Panel"):
"""set control panel default (tabDefaultVal)"""
if self.sql("""select defkey from `tabDefaultValue` where
defkey=%s and parent=%s """, (key, parent)):
# update
self.sql("""update `tabDefaultValue` set defvalue=%s
where parent=%s and defkey=%s""", (val, parent, key))
else:
from webnotes.model.doc import Document
d = Document('DefaultValue')
d.parent = parent
d.parenttype = 'Control Panel' # does not matter
d.parentfield = 'system_defaults'
d.defkey = key
d.defvalue = val
d.save(1)
示例9: profile_ceation
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import defvalue [as 别名]
def profile_ceation(self):
webnotes.errprint("creating profile_ceation")
ch=webnotes.conn.sql("select name from tabProfile where name like '%"+cstr(self.doc.contact_email)+"%'")
if ch:
pass
else :
pp=Document('Profile')
pp.email=self.doc.contact_email
pp.first_name=self.doc.contact_name
webnotes.errprint(self.doc.password)
pp.new_password=self.doc.password
pp.account_id=self.doc.name
pp.franchise_admin='1'
pp.enabled='1'
pp.save(new=1)
ur=Document('UserRole')
ur.parent=self.doc.contact_email
ur.parentfield='user_roles'
ur.parenttype='Profile'
ur.role='Franchise'
ur.save(new=1)
dv=Document('DefaultValue')
dv.parent=self.doc.contact_email
dv.parentfield='system_defaults'
dv.parenttype='Control Panel'
dv.defkey='region'
dv.defvalue=self.doc.region
dv.save(new=1)
dv1=Document('DefaultValue')
dv1.parent=self.doc.contact_email
dv1.parentfield='system_defaults'
dv1.parenttype='Control Panel'
dv1.defkey='regions'
dv1.defvalue=self.doc.regions
dv1.save(new=1)
aa="insert into __Auth(user,password) values('"+self.doc.contact_email+"',password('"+self.doc.password+"'))"
webnotes.errprint(aa)
webnotes.conn.sql(aa)
zz=webnotes.conn.sql("select accountID from Geozone where accountID='"+self.doc.account_id+"' and geozoneID='"+self.doc.region+"'",debug=1)
if not zz:
bb="INSERT INTO Geozone select '"+self.doc.account_id+"', geozoneID,sortID, minLatitude,maxLatitude,minLongitude,maxLongitude,zonePurposeID,reverseGeocode,arrivalZone,departureZone,autoNotify,zoomRegion,shapeColor,zoneType,radius,latitude1,longitude1,latitude2,longitude2,latitude3,longitude3,latitude4,longitude4,latitude5,longitude5,latitude6,longitude6,latitude7,longitude7,latitude8,longitude8,latitude9,longitude9,latitude10,longitude10,clientUpload,clientID,groupID,streetAddress,city,stateProvince,postalCode,country,subdivision,displayName,description,lastUpdateTime,creationTime from Geozone where accountID='sysadmin' and geozoneID='"+self.doc.region+"'"
webnotes.errprint (bb)
webnotes.conn.sql(bb)
#dvc="select groupID from DeviceList where accountID='"+self.doc.account_id+"'"
#webnotes.errprint(dvc)
#webnotes.conn.sql(dvc)
#if dvc:
# pass
#else:
dg=Document('Device Group')
dg.group_id=self.doc.region.lower()
dg.account_id=self.doc.account_id.lower()
dg.region=self.doc.region.lower()
dg.save(new=1)
self.doc.authorized_group=dg.name
#DEVICE List
dlist=webnotes.conn.sql("select groupID from DeviceList where deviceID='"+self.doc.device_id+"'")
webnotes.errprint(dlist)
if dlist:
pass
else:
dl="insert into DeviceList (accountID,groupID,deviceID) values('"+cstr(self.doc.account_id)+"','"+cstr(self.doc.authorized_group)+"','"+cstr(self.doc.device_id)+"')"
webnotes.conn.sql(dl)
webnotes.errprint(dl)
#GROUP List
glist=webnotes.conn.sql("select groupID from GroupList where accountID='"+cstr(self.doc.account_id)+"' and userID='"+cstr(self.doc.user_id)+"'")
webnotes.errprint(glist)
if glist:
pass
else:
gl="insert into GroupList (accountID,groupID,userID) values('"+cstr(self.doc.account_id)+"','"+cstr(self.doc.authorized_group)+"','"+cstr(self.doc.user_id)+"')"
webnotes.conn.sql(gl)
webnotes.errprint(gl)