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


Python Document.doc_type方法代码示例

本文整理汇总了Python中webnotes.model.doc.Document.doc_type方法的典型用法代码示例。如果您正苦于以下问题:Python Document.doc_type方法的具体用法?Python Document.doc_type怎么用?Python Document.doc_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在webnotes.model.doc.Document的用法示例。


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

示例1: insert_trigger

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import doc_type [as 别名]
def insert_trigger(doctype, docname, event_name, method):
	"inserts a new trigger record"
	
	from webnotes.model.doc import Document
	d = Document('DocTrigger')
	d.doc_type = doctype
	d.doc_name = docname
	d.event_name = event_name
	d.method = method
	d.save(1)
开发者ID:cmrajan,项目名称:wnframework,代码行数:12,代码来源:triggers.py

示例2: make_feed

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import doc_type [as 别名]
def make_feed(doc, subject, color):
	"makes a new Feed record"
	#msgprint(subject)
	from webnotes.model.doc import Document
	webnotes.conn.sql("delete from tabFeed where doc_type=%s and doc_name=%s", (doc.doctype, doc.name))
	f = Document('Feed')
	f.doc_type = doc.doctype
	f.doc_name = doc.name
	f.subject = subject
	f.color = color
	f.save(1)
开发者ID:Morphnus-IT-Solutions,项目名称:trimos,代码行数:13,代码来源:__init__.py

示例3: make_follower

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import doc_type [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)
开发者ID:Vichagserp,项目名称:cimworks,代码行数:13,代码来源:follow.py

示例4: copy_doctype_to_pfs

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import doc_type [as 别名]
def copy_doctype_to_pfs():
	"""
		Copy doctype to existing print formats
	"""
	pf_dt_list = webnotes.conn.sql("""
		SELECT format, parent
		FROM `tabDocFormat`""", as_list=1)
	
	from webnotes.model.doc import Document

	for pf, dt in pf_dt_list:
		try:
			d = Document('Print Format', pf)
			d.doc_type = dt
			d.save()
		except Exception, e:
			print e.args
			pass
开发者ID:AminfiBerlin,项目名称:erpnext,代码行数:20,代码来源:install_print_formats.py

示例5: install_print_format

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import doc_type [as 别名]
def install_print_format(args):
	"""
		Installs print format
		args is a dict consisting of following keys:
			* name
			* module
			* doctype
			* standard = "Yes"/"No"
			* file
	"""
	from webnotes.model.doc import Document
	d = Document('Print Format')
	d.name = args['name']
	f = open(args['file'])
	d.html = f.read()
	f.close()
	d.module = args['module']
	d.doc_type = args['doc_type']
	d.standard = args['standard']
	d.save(1)
	from webnotes.model.code import get_obj
	obj = get_obj('Print Format', args['name'])
	obj.on_update()
开发者ID:AminfiBerlin,项目名称:erpnext,代码行数:25,代码来源:install_print_formats.py

示例6: prepare_to_set

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import doc_type [as 别名]
	def prepare_to_set(self, prop, new_d, ref_d, dt_doclist, delete=0):
		"""
			Prepares docs of property setter
			sets delete property if it is required to be deleted
		"""
		# Check if property has changed compared to when it was loaded 
		if new_d.fields.get(prop) != ref_d.fields.get(prop) \
		and not \
		( \
			new_d.fields.get(prop) in [None, 0] \
			and ref_d.fields.get(prop) in [None, 0] \
		) and not \
		( \
			new_d.fields.get(prop) in [None, ''] \
			and ref_d.fields.get(prop) in [None, ''] \
		):
			#webnotes.msgprint("new: " + str(new_d.fields[prop]) + " | old: " + str(ref_d.fields[prop]))
			# Check if the new property is same as that in original doctype
			# If yes, we need to delete the property setter entry
			for dt_d in dt_doclist:
				if dt_d.name == ref_d.name \
				and (new_d.fields.get(prop) == dt_d.fields.get(prop) \
				or \
				( \
					new_d.fields.get(prop) in [None, 0] \
					and dt_d.fields.get(prop) in [None, 0] \
				) or \
				( \
					new_d.fields.get(prop) in [None, ''] \
					and dt_d.fields.get(prop) in [None, ''] \
				)):
					delete = 1
					break
		
			value = new_d.fields.get(prop)
			
			if prop in self.property_restrictions:
				allow_change = False
				for restrict_list in self.property_restrictions.get(prop):
					if value in restrict_list and \
							ref_d.fields.get(prop) in restrict_list:
						allow_change = True
						break
				if not allow_change:
					webnotes.msgprint("""\
						You cannot change '%s' of '%s' from '%s' to '%s'.
						%s can only be changed among %s.
						<i>Ignoring this change and saving.</i>""" % \
						(self.defaults.get(prop, {}).get("label") or prop,
						new_d.fields.get("label") or new_d.fields.get("idx"),
						ref_d.fields.get(prop), value,
						self.defaults.get(prop, {}).get("label") or prop,
						" -or- ".join([", ".join(r) for r in \
							self.property_restrictions.get(prop)])))
					return None

			# If the above conditions are fulfilled,
			# create a property setter doc, but dont save it yet.
			from webnotes.model.doc import Document
			d = Document('Property Setter')
			d.doctype_or_field = ref_d.doctype=='DocField' and 'DocField' or 'DocType'
			d.doc_type = self.doc.doc_type
			d.field_name = ref_d.fieldname
			d.property = prop
			d.value = value
			d.property_type = self.defaults[prop]['fieldtype']
			#d.default_value = self.defaults[prop]['default']
			d.select_doctype = self.doc.doc_type
			d.select_item = ref_d.label and "-".join([
				cstr(ref_d.label), cstr(ref_d.fieldtype),
				cstr(ref_d.fieldname)]) or None
			d.select_property = self.defaults[prop]['label']
			if delete: d.delete = 1
			
			if d.select_item:
				d.select_item = self.remove_forbidden(d.select_item)
			
			# return the property setter doc
			return d

		else: return None
开发者ID:gowrav-vishwakarma,项目名称:wnframework,代码行数:83,代码来源:customize_form.py

示例7: prepare_to_set

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import doc_type [as 别名]
	def prepare_to_set(self, prop, new_d, ref_d, dt_doclist, delete=0):
		"""
			Prepares docs of property setter
			sets delete property if it is required to be deleted
		"""
		# Check if property has changed compared to when it was loaded 
		if new_d.fields[prop] != ref_d.fields[prop] \
		and not \
		( \
			new_d.fields[prop] in [None, 0] \
			and ref_d.fields[prop] in [None, 0] \
		) and not \
		( \
			new_d.fields[prop] in [None, ''] \
			and ref_d.fields[prop] in [None, ''] \
		):
			#webnotes.msgprint("new: " + str(new_d.fields[prop]) + " | old: " + str(ref_d.fields[prop]))
			# Check if the new property is same as that in original doctype
			# If yes, we need to delete the property setter entry
			for dt_d in dt_doclist:
				if dt_d.name == ref_d.name \
				and (new_d.fields[prop] == dt_d.fields[prop] \
				or \
				( \
					new_d.fields[prop] in [None, 0] \
					and dt_d.fields[prop] in [None, 0] \
				) or \
				( \
					new_d.fields[prop] in [None, ''] \
					and dt_d.fields[prop] in [None, ''] \
				)):
					delete = 1
					break
		
			value = new_d.fields[prop]

			if prop == 'idx':
				if value > 1:
					for idoc in ([self.doc] + self.doclist):
							if idoc.fields[prop] == (value - 1):
								prop = 'previous_field'
								value = idoc.name
								break
				elif value == 1:
					prop = 'previous_field'
					value = None

			# If the above conditions are fulfilled,
			# create a property setter doc, but dont save it yet.
			from webnotes.model.doc import Document
			d = Document('Property Setter')
			d.doctype_or_field = ref_d.doctype=='DocField' and 'DocField' or 'DocType'
			d.doc_type = self.true_doctype
			d.doc_name = ref_d.name
			d.property = prop
			d.value = value
			d.property_type = self.defaults[prop]['fieldtype']
			d.default_value = self.defaults[prop]['default']
			d.select_doctype = self.doc.doc_type
			d.select_item = ref_d.label and str(ref_d.idx) \
				+ " - " + str(ref_d.label) \
				+	" (" + str(ref_d.fieldtype) + ")" \
				or None
			d.select_property = self.defaults[prop]['label']
			if delete: d.delete = 1
			
			if d.select_item:
				d.select_item = self.remove_forbidden(d.select_item)
			
			# return the property setter doc
			return d

		else: return None
开发者ID:beliezer,项目名称:wnframework,代码行数:75,代码来源:doclayer.py


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