当前位置: 首页>>代码示例>>Python>>正文


Python doctype.get函数代码示例

本文整理汇总了Python中webnotes.model.doctype.get函数的典型用法代码示例。如果您正苦于以下问题:Python get函数的具体用法?Python get怎么用?Python get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_label_and_type

	def get_label_and_type(self, from_dt, to_dt):
		"""get label, fieldtype"""
		from_flds, to_flds = {}, {}
		for d in get(from_dt, 0):
			from_flds[d.fieldname] = {'label': d.label, 'fieldtype': d.fieldtype}

		for d in get(to_dt, 0):
			to_flds[d.fieldname] = {'label': d.label, 'fieldtype': d.fieldtype}

		return from_flds, to_flds
开发者ID:gangadhar-kadam,项目名称:adb-wnf,代码行数:10,代码来源:doctype_mapper.py

示例2: check_fields_in_dt

	def check_fields_in_dt(self):
		"""
			Check if any wrong fieldname entered in mapper
		"""
		flds = {}
		for t in getlist(self.doclist, 'table_mapper_details'):
			from_flds = [cstr(d.fieldname) for d in get(t.from_table, 0)]
			to_flds = [cstr(d.fieldname) for d in get(t.to_table, 0)]
			flds[cstr(t.match_id)] = [cstr(t.from_table), from_flds, cstr(t.to_table), to_flds]

		for d in getlist(self.doclist, 'field_mapper_details'):
			# Default fields like name, parent, owner does not exists in DocField
			if d.from_field not in flds[cstr(d.match_id)][1] and d.from_field not in default_fields:
				msgprint("'%s' does not exists in DocType: '%s'" % (cstr(d.from_field), cstr(flds[cstr(d.match_id)][0])))
			if d.to_field not in flds[cstr(d.match_id)][3] and d.to_field not in default_fields:
				msgprint("'%s' does not exists in DocType: '%s'" % (cstr(d.to_field), cstr(flds[cstr(d.match_id)][2])))
开发者ID:gangadhar-kadam,项目名称:adb-wnf,代码行数:16,代码来源:doctype_mapper.py

示例3: validate

	def validate(self):
		from webnotes.model.doctype import get
		temp_doclist = get(self.doc.dt).get_parent_doclist()
				
		# set idx
		if not self.doc.idx:
			max_idx = max(d.idx for d in temp_doclist if d.doctype=='DocField')
			self.doc.idx = cint(max_idx) + 1
开发者ID:Halfnhav,项目名称:wnframework,代码行数:8,代码来源:custom_field.py

示例4: get_fields_with_same_name

	def get_fields_with_same_name(self, t, flds):
		"""
			Returns field list with same name in from and to doctype
		"""
		import copy
		exception_flds = copy.copy(default_fields)
		exception_flds += [f[1] for f in flds]
		
		from_flds = [d.fieldname for d in get(t['from_table']).get_parent_doclist() \
			if cint(d.no_copy) == 0 and d.docstatus != 2 and d.fieldname \
			and d.fieldtype not in ('Table', 'Section Break', 'Column Break', 'HTML', 'Button')]

		to_flds = [d.fieldname for d in get(t['to_table']).get_parent_doclist() \
			if cint(d.no_copy) == 0 and d.docstatus != 2 and d.fieldname \
			and d.fieldtype not in ('Table', 'Section Break', 'Column Break', 'HTML', 'Button')]
		
		similar_flds = [[d, d, 'Yes'] for d in from_flds \
			if d in to_flds and d not in exception_flds]
						
		return similar_flds
开发者ID:gangadhar-kadam,项目名称:adb-wnf,代码行数:20,代码来源:doctype_mapper.py

示例5: get_ref_doclist

	def get_ref_doclist(self):
		"""
			* Gets doclist of type self.doc.doc_type
			* Applies property setter properties on the doclist
			* returns the modified doclist
		"""
		from webnotes.model.doctype import get

		ref_doclist = get(self.doc.doc_type, form=0)

		return ref_doclist
开发者ID:mehulsbhatt,项目名称:wnframework,代码行数:11,代码来源:customize_form.py

示例6: get_ref_doclist

    def get_ref_doclist(self):
        """
			* Gets doclist of type self.doc.doc_type
			* Applies property setter properties on the doclist
			* returns the modified doclist
		"""
        from webnotes.model.doctype import get

        ref_doclist = get(self.doc.doc_type)
        ref_doclist = webnotes.doclist([ref_doclist[0]] + ref_doclist.get({"parent": self.doc.doc_type}))

        return ref_doclist
开发者ID:arunemmanuel,项目名称:wnframework,代码行数:12,代码来源:customize_form.py

示例7: validate

	def validate(self):
		self.set_fieldname()
		
		from webnotes.model.doctype import get
		temp_doclist = get(self.doc.dt, form=0)
		
		self.validate_field(temp_doclist)
		
		# set idx
		if not self.doc.idx:
			from webnotes.utils import cint
			max_idx = max(d.idx for d in temp_doclist if d.doctype=='DocField')
			self.doc.idx = cint(max_idx) + 1
开发者ID:NorrWing,项目名称:wnframework,代码行数:13,代码来源:custom_field.py

示例8: assign_idx

def assign_idx(cf):
	from webnotes.model.doctype import get
	from webnotes.utils import cint
	#print len(cf)
	for f in cf:
		#print f.get('dt'), f.get('name')
		if f.get('idx'): continue
		temp_doclist = get(f.get('dt'), form=0)
		#print len(temp_doclist)
		max_idx = max(d.idx for d in temp_doclist if d.doctype=='DocField')
		if not max_idx: continue
		webnotes.conn.sql("""\
			UPDATE `tabCustom Field` SET idx=%s
			WHERE name=%s""", (cint(max_idx)+1, f.get('name')))
开发者ID:AminfiBerlin,项目名称:erpnext,代码行数:14,代码来源:doctype_get_refactor.py

示例9: filter_fields

def filter_fields(doc):
	from webnotes.model.doctype import get
	from webnotes.model import default_fields

	doctypelist = get(doc.doctype, False)
	valid_fields = [d.fieldname for d in doctypelist.get({"parent":doc.doctype,
		"doctype":"DocField"})]
	to_remove = []
	
	for key in doc:
		if (not key in default_fields) and (not key in valid_fields):
			to_remove.append(key)
		elif doc[key]==None:
			to_remove.append(key)
			
	for key in to_remove:
		del doc[key]
	
	return doc
开发者ID:Yellowen,项目名称:wnframework,代码行数:19,代码来源:export_file.py

示例10: validate_permissions_for_doctype

def validate_permissions_for_doctype(doctype, for_remove=False):
	from webnotes.model.doctype import get
	validate_permissions(get(doctype, cached=False).get({"parent":doctype, 
		"doctype":"DocPerm"}), for_remove)
开发者ID:rohitw1991,项目名称:latestadbwnf,代码行数:4,代码来源:doctype.py

示例11: validate_fields_for_doctype

def validate_fields_for_doctype(doctype):
	from webnotes.model.doctype import get
	validate_fields(get(doctype, cached=False).get({"parent":doctype, 
		"doctype":"DocField"}))
开发者ID:rohitw1991,项目名称:latestadbwnf,代码行数:4,代码来源:doctype.py

示例12: validate_fields_for_doctype

def validate_fields_for_doctype(doctype):
	from webnotes.model.doctype import get
	validate_fields(filter(lambda d: d.doctype=="DocField" and d.parent==doctype, 
		get(doctype, cached=False)))
开发者ID:gowrav-vishwakarma,项目名称:wnframework,代码行数:4,代码来源:doctype.py


注:本文中的webnotes.model.doctype.get函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。