• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python webnotes.doclist函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: set_doclist

	def set_doclist(self, docs):
		for i, d in enumerate(docs):
			if isinstance(d, dict):
				docs[i] = Document(fielddata=d)
		
		self.docs = self.doclist = webnotes.doclist(docs)
		self.doc, self.children = docs[0], webnotes.doclist(docs[1:])
		if self.obj:
			self.obj.doclist = self.doclist
			self.obj.doc = self.doc
开发者ID:masums,项目名称:wnframework,代码行数:10,代码来源:wrapper.py


示例2: add_communication_list

	def add_communication_list(self):
		# remove communications if present
		self.doclist = webnotes.doclist(self.doclist).get({"doctype": ["!=", "Communcation"]})
		
		comm_list = webnotes.conn.sql("""select * from tabCommunication 
			where support_ticket=%s order by modified desc limit 20""", self.doc.name, as_dict=1)
		
		[d.update({"doctype":"Communication"}) for d in comm_list]
		
		self.doclist.extend(webnotes.doclist([webnotes.doc(fielddata=d) \
			for d in comm_list]))
开发者ID:hbkfabio,项目名称:erpnext,代码行数:11,代码来源:support_ticket.py


示例3: add_communication_list

	def add_communication_list(self):
		# remove communications if present
		self.doclist = webnotes.doclist(self.doclist).get({
			"doctype": ["!=", "Communcation"]})
		
		comm_list = webnotes.conn.sql("""select * from tabCommunication 
			where %s=%s order by modified desc limit 20""" \
			% (self.doc.doctype.replace(" ", "_").lower(), "%s"),
			self.doc.name, as_dict=1, update={"doctype":"Communication"})
		
		self.doclist.extend(webnotes.doclist([webnotes.doc(fielddata=d) \
			for d in comm_list]))
开发者ID:jitendralive,项目名称:erpnext,代码行数:12,代码来源:transaction_base.py


示例4: post

	def post(self):
		"""
			Save diff between Customize Form Bean and DocType Bean as property setter entries
		"""
		if self.doc.doc_type:
			from webnotes.model import doc
			from webnotes.core.doctype.doctype.doctype import validate_fields_for_doctype
			
			this_doclist = webnotes.doclist([self.doc] + self.doclist)
			ref_doclist = self.get_ref_doclist()
			dt_doclist = doc.get('DocType', self.doc.doc_type)
			
			# get a list of property setter docs
			self.idx_dirty = False
			diff_list = self.diff(this_doclist, ref_doclist, dt_doclist)
			
			if self.idx_dirty:
				self.make_idx_property_setter(this_doclist, diff_list)
			
			self.set_properties(diff_list)

			validate_fields_for_doctype(self.doc.doc_type)

			webnotes.clear_cache(doctype=self.doc.doc_type)
			webnotes.msgprint("Updated")
开发者ID:bindscha,项目名称:wnframework_old,代码行数:25,代码来源:customize_form.py


示例5: make_test_objects

def make_test_objects(doctype, test_records, verbose=None):
	records = []
		
	for doclist in test_records:
		if not "doctype" in doclist[0]:
			doclist[0]["doctype"] = doctype
		d = webnotes.bean((webnotes.doclist(doclist)).copy())
		if webnotes.test_objects.get(d.doc.doctype):
			# do not create test records, if already exists
			return []
		if has_field(d.doc.doctype, "naming_series"):
			if not d.doc.naming_series:
				d.doc.naming_series = "_T-" + d.doc.doctype + "-"

		# submit if docstatus is set to 1 for test record
		docstatus = d.doc.docstatus
		
		d.doc.docstatus = 0
		d.insert()

		if docstatus == 1:
			d.submit()
		
		records.append(d.doc.name)
	return records
开发者ID:appost,项目名称:wnframework,代码行数:25,代码来源:test_runner.py


示例6: load_from_db

    def load_from_db(self, dt=None, dn=None, prefix="tab"):
        """
			Load doclist from dt
		"""
        from webnotes.model.doc import getchildren

        if not dt:
            dt = self.doc.doctype
        if not dn:
            dn = self.doc.name

        doc = Document(dt, dn, prefix=prefix)

        # get all children types
        tablefields = webnotes.model.meta.get_table_fields(dt)

        # load chilren
        doclist = webnotes.doclist([doc])
        for t in tablefields:
            doclist += getchildren(doc.name, t[0], t[1], dt, prefix=prefix)

        self.set_doclist(doclist)

        if dt == dn:
            self.convert_type(self.doc)
开发者ID:rohitw1991,项目名称:latestadbwnf,代码行数:25,代码来源:bean.py


示例7: get_mapped_doclist

def get_mapped_doclist(from_doctype, from_docname, table_maps, target_doclist=[], 
		postprocess=None, ignore_permissions=False):
	if isinstance(target_doclist, basestring):
		target_doclist = json.loads(target_doclist)
	
	source = webnotes.bean(from_doctype, from_docname)

	if not ignore_permissions and not webnotes.has_permission(from_doctype, "read", source.doc):
		webnotes.msgprint("No Permission", raise_exception=webnotes.PermissionError)

	source_meta = webnotes.get_doctype(from_doctype)
	target_meta = webnotes.get_doctype(table_maps[from_doctype]["doctype"])
	
	# main
	if target_doclist:
		if isinstance(target_doclist[0], dict):
			target_doc = webnotes.doc(fielddata=target_doclist[0])
		else:
			target_doc = target_doclist[0]
	else:
		target_doc = webnotes.new_doc(table_maps[from_doctype]["doctype"])
	
	map_doc(source.doc, target_doc, table_maps[source.doc.doctype], source_meta, target_meta)
	if target_doclist:
		target_doclist[0] = target_doc
	else:
		target_doclist = [target_doc]
	
	# children
	for source_d in source.doclist[1:]:
		table_map = table_maps.get(source_d.doctype)
		if table_map:
			if "condition" in table_map:
				if not table_map["condition"](source_d):
					continue
			target_doctype = table_map["doctype"]
			parentfield = target_meta.get({
					"parent": target_doc.doctype, 
					"doctype": "DocField",
					"fieldtype": "Table", 
					"options": target_doctype
				})[0].fieldname
			
			if table_map.get("add_if_empty") and row_exists_in_target(parentfield, target_doclist):
				continue
		
			target_d = webnotes.new_doc(target_doctype, target_doc, parentfield)
			map_doc(source_d, target_d, table_map, source_meta, target_meta, source.doclist[0])
			target_doclist.append(target_d)
	
	target_doclist = webnotes.doclist(target_doclist)
	
	if postprocess:
		new_target_doclist = postprocess(source, target_doclist)
		if new_target_doclist:
			target_doclist = new_target_doclist
	
	return target_doclist
开发者ID:frank1638,项目名称:wnframework,代码行数:58,代码来源:mapper.py


示例8: set_doclist

	def set_doclist(self, doclist):
		for i, d in enumerate(doclist):
			if isinstance(d, dict):
				doclist[i] = Document(fielddata=d)
		
		self.doclist = webnotes.doclist(doclist)
		self.doc = self.doclist[0]
		if self.obj:
			self.obj.doclist = self.doclist
			self.obj.doc = self.doc
开发者ID:Halfnhav,项目名称:wnframework,代码行数:10,代码来源:bean.py


示例9: cleanup_raw_materials_supplied

	def cleanup_raw_materials_supplied(self, parent_items, raw_material_table):
		"""Remove all those child items which are no longer present in main item table"""
		delete_list = []
		for d in self.doclist.get({"parentfield": raw_material_table}):
			if [d.main_item_code, d.reference_name] not in parent_items:
				# mark for deletion from doclist
				delete_list.append([d.main_item_code, d.reference_name])

		# delete from doclist
		self.doclist = webnotes.doclist(filter(lambda d: [d.main_item_code, d.reference_name]
			not in delete_list, self.doclist))
开发者ID:aproxp,项目名称:erpnext,代码行数:11,代码来源:buying_controller.py


示例10: 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


示例11: cleanup_packing_list

def cleanup_packing_list(obj, parent_items):
	"""Remove all those child items which are no longer present in main item table"""
	delete_list = []
	for d in obj.doclist.get({"parentfield": "packing_details"}):
		if [d.parent_item, d.parent_detail_docname] not in parent_items:
			# mark for deletion from doclist
			delete_list.append([d.parent_item, d.parent_detail_docname])

	if not delete_list:
		return obj.doclist
	
	# delete from doclist
	obj.doclist = webnotes.doclist(filter(lambda d: [d.parent_item, d.parent_detail_docname] 
		not in delete_list, obj.doclist))
		
	return obj.doclist
开发者ID:Anirudh887,项目名称:erpnext,代码行数:16,代码来源:packed_item.py


示例12: make_test_objects

def make_test_objects(doctype, test_records):		
	records = []
		
	for doclist in test_records:
		if not "doctype" in doclist[0]:
			doclist[0]["doctype"] = doctype
		d = webnotes.model_wrapper((webnotes.doclist(doclist)).copy())
		if webnotes.test_objects.get(d.doc.doctype):
			# do not create test records, if already exists
			return []
		if has_field(d.doc.doctype, "naming_series"):
			if not d.doc.naming_series:
				d.doc.naming_series = "_T-" + d.doc.doctype + "-"

		d.insert()
		records.append(d.doc.name)
	return records
开发者ID:IPenuelas,项目名称:wnframework,代码行数:17,代码来源:test_runner.py


示例13: load_from_db

	def load_from_db(self, dt=None, dn=None, prefix='tab'):
		
		from webnotes.model.doc import Document, getchildren

		if not dt: dt = self.doc.doctype
		if not dn: dn = self.doc.name

		doc = Document(dt, dn, prefix=prefix)

		# get all children types
		tablefields = webnotes.model.meta.get_table_fields(dt)

		# load chilren
		doclist = webnotes.doclist([doc,])
		for t in tablefields:
			doclist += getchildren(doc.name, t[0], t[1], dt, prefix=prefix)

		self.set_doclist(doclist)
		self.run_method("onload")
开发者ID:MiteshC,项目名称:wnframework,代码行数:19,代码来源:wrapper.py


示例14: post

	def post(self):
		"""
			Save diff between Customize Form ModelWrapper and DocType ModelWrapper as property setter entries
		"""
		if self.doc.doc_type:
			from webnotes.model import doc
			from core.doctype.doctype.doctype import validate_fields_for_doctype
			
			this_doclist = webnotes.doclist([self.doc] + self.doclist)
			ref_doclist = self.get_ref_doclist()
			dt_doclist = doc.get('DocType', self.doc.doc_type)
			
			# get a list of property setter docs
			diff_list = self.diff(this_doclist, ref_doclist, dt_doclist)
			
			self.set_properties(diff_list)

			validate_fields_for_doctype(self.doc.doc_type)

			webnotes.clear_cache(doctype=self.doc.doc_type)
开发者ID:gowrav-vishwakarma,项目名称:wnframework,代码行数:20,代码来源:customize_form.py


示例15: make_purchase_order_based_on_supplier

def make_purchase_order_based_on_supplier(source_name, target_doclist=None):
	from webnotes.model.mapper import get_mapped_doclist
	if target_doclist:
		if isinstance(target_doclist, basestring):
			import json
			target_doclist = webnotes.doclist(json.loads(target_doclist))
		target_doclist = target_doclist.get({"parentfield": ["!=", "po_details"]})
		
	material_requests, supplier_items = get_material_requests_based_on_supplier(source_name)
	
	def postprocess(source, target_doclist):
		target_doclist[0].supplier = source_name
		set_missing_values(source, target_doclist)
		
		po_items = target_doclist.get({"parentfield": "po_details"})
		target_doclist = target_doclist.get({"parentfield": ["!=", "po_details"]}) + \
			[d for d in po_items 
				if d.fields.get("item_code") in supplier_items and d.fields.get("qty") > 0]
		
		return target_doclist
		
	for mr in material_requests:
		target_doclist = get_mapped_doclist("Material Request", mr, 	{
			"Material Request": {
				"doctype": "Purchase Order", 
			}, 
			"Material Request Item": {
				"doctype": "Purchase Order Item", 
				"field_map": [
					["name", "prevdoc_detail_docname"], 
					["parent", "prevdoc_docname"], 
					["parenttype", "prevdoc_doctype"], 
					["uom", "stock_uom"],
					["uom", "uom"]
				],
				"postprocess": update_item
			}
		}, target_doclist, postprocess)
	
	return [d.fields for d in target_doclist]
开发者ID:LPlusPlus,项目名称:erpnext,代码行数:40,代码来源:material_request.py


示例16: cleanup_packing_list

	def cleanup_packing_list(self, obj, parent_items):
		"""Remove all those child items which are no longer present in main item table"""
		delete_list = []
		for d in getlist(obj.doclist, 'packing_details'):
			if [d.parent_item, d.parent_detail_docname] not in parent_items:
				# mark for deletion from doclist
				delete_list.append(d.name)

		if not delete_list:
			return obj.doclist
		
		# delete from doclist
		obj.doclist = webnotes.doclist(filter(lambda d: d.name not in delete_list, obj.doclist))
		
		# delete from db
		webnotes.conn.sql("""\
			delete from `tabDelivery Note Packing Item`
			where name in (%s)"""
			% (", ".join(["%s"] * len(delete_list))),
			tuple(delete_list))
			
		return obj.doclist
开发者ID:mxmo-co,项目名称:erpnext,代码行数:22,代码来源:sales_common.py


示例17: clear_table

	def clear_table(self, doclist, tablefield, save=0):
		"""
		Clears the child records from the given `doclist` for a particular `tablefield`
		"""
		from webnotes.model.utils import getlist
		
		table_list = getlist(doclist, tablefield)
				
		delete_list = [d.name for d in table_list]
		
		if delete_list:
			#filter doclist
			doclist = filter(lambda d: d.name not in delete_list, doclist)
		
			# delete from db
			webnotes.conn.sql("""\
				delete from `tab%s`
				where parent=%s and parenttype=%s"""
				% (table_list[0].doctype, '%s', '%s'),
				(self.name, self.doctype))

			self.fields['__unsaved'] = 1
		
		return webnotes.doclist(doclist)
开发者ID:appost,项目名称:wnframework,代码行数:24,代码来源:doc.py


示例18: get_parent_doclist

	def get_parent_doclist(self):
		return webnotes.doclist([self[0]] + self.get({"parent": self[0].name}))
开发者ID:bindscha,项目名称:wnframework_old,代码行数:2,代码来源:doctype.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python webnotes.errprint函数代码示例发布时间:2022-05-26
下一篇:
Python webnotes.doc函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap