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

Python bean.getlist函数代码示例

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

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



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

示例1: check_final_result

	def check_final_result(self):
		count=0
		if self.doc.density=='By Weight':

			for m in getlist(self.doclist, 'density_details'):
				if m.consider_for_final_result==1:
					#webnotes.errprint(m.break_no)
					count=count+1
					#webnotes.errprint(count)
			if count==1:
				pass
			else:
				#webnotes.errprint(count)
				webnotes.msgprint("At most one record needed for consideration of final result from Density Details Child Table.",raise_exception=1);


		if self.doc.density=='By Hydrometer':

			for n in getlist(self.doclist, 'density_reading'):
				if n.consider_for_final_result==1:
					#webnotes.errprint(m.break_no)
					count=count+1
					#webnotes.errprint(count)
			if count==1:
				pass
			else:
				#webnotes.errprint(count)
				webnotes.msgprint("At most one record needed for consideration of final result from Density Details Child Table.",raise_exception=1);
开发者ID:saurabh6790,项目名称:trufil_app,代码行数:28,代码来源:physical_condition_and_density.py


示例2: create_sal_slip

	def create_sal_slip(self):
		"""
			Creates salary slip for selected employees if already not created
		
		"""
		
		emp_list = self.get_emp_list()
		ss_list = []
		for emp in emp_list:
			if not sql("""select name from `tabSalary Slip` 
					where docstatus!= 2 and employee = %s and month = %s and fiscal_year = %s and company = %s
					""", (emp[0], self.doc.month, self.doc.fiscal_year, self.doc.company)):
				ss = Document('Salary Slip')
				ss.fiscal_year = self.doc.fiscal_year
				ss.employee = emp[0]
				ss.month = self.doc.month
				ss.email_check = self.doc.send_email
				ss.company = self.doc.company
				ss.save(1)
			
				ss_obj = get_obj('Salary Slip', ss.name, with_children=1)
				ss_obj.get_emp_and_leave_details()
				ss_obj.calculate_net_pay()
				ss_obj.validate()
				ss_obj.doc.save()
			
				for d in getlist(ss_obj.doclist, 'earning_details'):
					d.save()
				for d in getlist(ss_obj.doclist, 'deduction_details'):
					d.save()
					
				ss_list.append(ss.name)
		
		return self.create_log(ss_list)
开发者ID:BillTheBest,项目名称:erpnext,代码行数:34,代码来源:salary_manager.py


示例3: cal_charges_and_item_tax_amt

	def cal_charges_and_item_tax_amt(self):
		""" Re-calculates other charges values and itemwise tax amount for getting valuation rate"""
		import json
		for pr in self.selected_pr:
			obj = get_obj('Purchase Receipt', pr, with_children = 1)
			total = 0
			self.reset_other_charges(obj)

			for prd in getlist(obj.doclist, 'purchase_receipt_details'):
				prev_total, item_tax = flt(prd.amount), 0
				total += flt(prd.qty) * flt(prd.purchase_rate)
			
				try:
					item_tax_rate = prd.item_tax_rate and json.loads(prd.item_tax_rate) or {}
				except ValueError:
					item_tax_rate = prd.item_tax_rate and eval(prd.item_tax_rate) or {}

				
				ocd = getlist(obj.doclist, 'purchase_tax_details')
				# calculate tax for other charges
				for oc in range(len(ocd)):
					# Get rate : consider if diff for this item
					if item_tax_rate.get(ocd[oc].account_head) and ocd[oc].charge_type != 'Actual':
						rate = item_tax_rate[ocd[oc].account_head]
					else:
						rate = flt(ocd[oc].rate)
				
					tax_amount = self.cal_tax(ocd, prd, rate, obj.doc.net_total, oc)					
					total, prev_total, item_tax = self.add_deduct_taxes(ocd, oc, tax_amount, total, prev_total, item_tax)

				prd.item_tax_amount = flt(item_tax)
				prd.save()
			obj.doc.save()
开发者ID:BillTheBest,项目名称:erpnext,代码行数:33,代码来源:landed_cost_wizard.py


示例4: get_allocated_sum

	def get_allocated_sum(self,obj):
		sum = 0
		for d in getlist(obj.doclist,'sales_team'):
			sum += flt(d.allocated_percentage)
		if (flt(sum) != 100) and getlist(obj.doclist,'sales_team'):
			msgprint("Total Allocated % of Sales Persons should be 100%")
			raise Exception
开发者ID:jacara,项目名称:erpclone,代码行数:7,代码来源:sales_common.py


示例5: on_submit

	def on_submit(self):
		if not getlist(self.doclist, 'maintenance_schedule_detail'):
			msgprint("Please click on 'Generate Schedule' to get schedule")
			raise Exception
		self.check_serial_no_added()
		self.validate_serial_no_warranty()
		self.validate_schedule()

		email_map ={}
		for d in getlist(self.doclist, 'item_maintenance_detail'):
			if d.serial_no:
				self.update_amc_date(d.serial_no, d.end_date)

			if d.incharge_name not in email_map:
				e = sql("select email_id, name from `tabSales Person` where name='%s' " %(d.incharge_name),as_dict=1)[0]
				email_map[d.incharge_name] = (e['email_id'])

			scheduled_date =sql("select scheduled_date from `tabMaintenance Schedule Detail` \
				where incharge_name='%s' and item_code='%s' and parent='%s' " %(d.incharge_name, \
				d.item_code, self.doc.name), as_dict=1)

			for key in scheduled_date:
				if email_map[d.incharge_name]:
					self.add_calender_event(key["scheduled_date"],email_map[d.incharge_name],d.item_code)		 
		webnotes.conn.set(self.doc, 'status', 'Submitted')		
开发者ID:BillTheBest,项目名称:erpnext,代码行数:25,代码来源:maintenance_schedule.py


示例6: get_balance

	def get_balance(self):
		if not getlist(self.doclist,'entries'):
			msgprint("Please enter atleast 1 entry in 'GL Entries' table")
		else:
			flag, self.doc.total_debit, self.doc.total_credit = 0, 0, 0
			diff = flt(self.doc.difference, 2)
			
			# If any row without amount, set the diff on that row
			for d in getlist(self.doclist,'entries'):
				if not d.credit and not d.debit and diff != 0:
					if diff>0:
						d.credit = diff
					elif diff<0:
						d.debit = diff
					flag = 1
					
			# Set the diff in a new row
			if flag == 0 and diff != 0:
				jd = addchild(self.doc, 'entries', 'Journal Voucher Detail', self.doclist)
				if diff>0:
					jd.credit = abs(diff)
				elif diff<0:
					jd.debit = abs(diff)
					
			# Set the total debit, total credit and difference
			for d in getlist(self.doclist,'entries'):
				self.doc.total_debit += flt(d.debit, 2)
				self.doc.total_credit += flt(d.credit, 2)

			self.doc.difference = flt(self.doc.total_debit, 2) - flt(self.doc.total_credit, 2)
开发者ID:cocoy,项目名称:erpnext,代码行数:30,代码来源:journal_voucher.py


示例7: get_item_list

    def get_item_list(self, obj, is_stopped=0):
        """get item list"""
        il = []
        for d in getlist(obj.doclist, obj.fname):
            reserved_warehouse = ""
            reserved_qty_for_main_item = 0

            if obj.doc.doctype == "Sales Order":
                reserved_warehouse = d.reserved_warehouse
                if flt(d.qty) > flt(d.delivered_qty):
                    reserved_qty_for_main_item = flt(d.qty) - flt(d.delivered_qty)

            if obj.doc.doctype == "Delivery Note" and d.prevdoc_doctype == "Sales Order":
                # if SO qty is 10 and there is tolerance of 20%, then it will allow DN of 12.
                # But in this case reserved qty should only be reduced by 10 and not 12

                already_delivered_qty = self.get_already_delivered_qty(
                    obj.doc.name, d.prevdoc_docname, d.prevdoc_detail_docname
                )
                so_qty, reserved_warehouse = self.get_so_qty_and_warehouse(d.prevdoc_detail_docname)

                if already_delivered_qty + d.qty > so_qty:
                    reserved_qty_for_main_item = -(so_qty - already_delivered_qty)
                else:
                    reserved_qty_for_main_item = -flt(d.qty)

            if self.has_sales_bom(d.item_code):
                for p in getlist(obj.doclist, "packing_details"):
                    if p.parent_detail_docname == d.name and p.parent_item == d.item_code:
                        # the packing details table's qty is already multiplied with parent's qty
                        il.append(
                            {
                                "warehouse": p.warehouse,
                                "reserved_warehouse": reserved_warehouse,
                                "item_code": p.item_code,
                                "qty": flt(p.qty),
                                "reserved_qty": (flt(p.qty) / flt(d.qty)) * reserved_qty_for_main_item,
                                "uom": p.uom,
                                "batch_no": cstr(p.batch_no).strip(),
                                "serial_no": cstr(p.serial_no).strip(),
                                "name": d.name,
                            }
                        )
            else:
                il.append(
                    {
                        "warehouse": d.warehouse,
                        "reserved_warehouse": reserved_warehouse,
                        "item_code": d.item_code,
                        "qty": d.qty,
                        "reserved_qty": reserved_qty_for_main_item,
                        "uom": d.stock_uom,
                        "batch_no": cstr(d.batch_no).strip(),
                        "serial_no": cstr(d.serial_no).strip(),
                        "name": d.name,
                    }
                )
        return il
开发者ID:soerenhb,项目名称:erpnext,代码行数:58,代码来源:sales_common.py


示例8: validate_reference_value

	def validate_reference_value(self, obj, to_docname):
		""" Check consistency of value with reference document"""
		for t in getlist(self.doclist, 'table_mapper_details'):
			# Reference key is the fieldname which will relate to the from_table
			if t.reference_doctype_key:
				for d in getlist(obj.doclist, t.to_field):
					if d.fields[t.reference_doctype_key] == self.doc.from_doctype:
						self.check_consistency(obj.doc, d, to_docname)
						self.check_ref_docstatus()
开发者ID:gangadhar-kadam,项目名称:adb-wnf,代码行数:9,代码来源:doctype_mapper.py


示例9: validate_warehouse

	def validate_warehouse(self, pro_obj):
		"""perform various (sometimes conditional) validations on warehouse"""
		
		source_mandatory = ["Material Issue", "Material Transfer", "Purchase Return"]
		target_mandatory = ["Material Receipt", "Material Transfer", "Sales Return"]
		
		validate_for_manufacture_repack = any([d.bom_no for d in self.doclist.get(
			{"parentfield": "mtn_details"})])

		if self.doc.purpose in source_mandatory and self.doc.purpose not in target_mandatory:
			self.doc.to_warehouse = None
			for d in getlist(self.doclist, 'mtn_details'):
				d.t_warehouse = None
		elif self.doc.purpose in target_mandatory and self.doc.purpose not in source_mandatory:
			self.doc.from_warehouse = None
			for d in getlist(self.doclist, 'mtn_details'):
				d.s_warehouse = None

		for d in getlist(self.doclist, 'mtn_details'):
			if not d.s_warehouse and not d.t_warehouse:
				d.s_warehouse = self.doc.from_warehouse
				d.t_warehouse = self.doc.to_warehouse

			if not (d.s_warehouse or d.t_warehouse):
				msgprint(_("Atleast one warehouse is mandatory"), raise_exception=1)
			
			if self.doc.purpose in source_mandatory and not d.s_warehouse:
				msgprint(_("Row # ") + "%s: " % cint(d.idx)
					+ _("Source Warehouse") + _(" is mandatory"), raise_exception=1)
				
			if self.doc.purpose in target_mandatory and not d.t_warehouse:
				msgprint(_("Row # ") + "%s: " % cint(d.idx)
					+ _("Target Warehouse") + _(" is mandatory"), raise_exception=1)

			if self.doc.purpose == "Manufacture/Repack":
				if validate_for_manufacture_repack:
					if d.bom_no:
						d.s_warehouse = None
						
						if not d.t_warehouse:
							msgprint(_("Row # ") + "%s: " % cint(d.idx)
								+ _("Target Warehouse") + _(" is mandatory"), raise_exception=1)
						
						elif pro_obj and cstr(d.t_warehouse) != pro_obj.doc.fg_warehouse:
							msgprint(_("Row # ") + "%s: " % cint(d.idx)
								+ _("Target Warehouse") + _(" should be same as that in ")
								+ _("Production Order"), raise_exception=1)
					
					else:
						d.t_warehouse = None
						if not d.s_warehouse:
							msgprint(_("Row # ") + "%s: " % cint(d.idx)
								+ _("Source Warehouse") + _(" is mandatory"), raise_exception=1)
			
			if cstr(d.s_warehouse) == cstr(d.t_warehouse):
				msgprint(_("Source and Target Warehouse cannot be same"), 
					raise_exception=1)
开发者ID:andrewabel,项目名称:erpnext,代码行数:57,代码来源:stock_entry.py


示例10: get_item_list

	def get_item_list(self, obj, is_stopped=0):
		"""get item list"""
		il = []
		for d in getlist(obj.doclist, obj.fname):
			reserved_warehouse = ""
			reserved_qty_for_main_item = 0
			
			if obj.doc.doctype == "Sales Order":
				if (webnotes.conn.get_value("Item", d.item_code, "is_stock_item") == 'Yes' or 
					self.has_sales_bom(d.item_code)) and not d.reserved_warehouse:
						webnotes.throw(_("Please enter Reserved Warehouse for item ") + 
							d.item_code + _(" as it is stock Item or packing item"))
				reserved_warehouse = d.reserved_warehouse
				if flt(d.qty) > flt(d.delivered_qty):
					reserved_qty_for_main_item = flt(d.qty) - flt(d.delivered_qty)
				
			if obj.doc.doctype == "Delivery Note" and d.against_sales_order:
				# if SO qty is 10 and there is tolerance of 20%, then it will allow DN of 12.
				# But in this case reserved qty should only be reduced by 10 and not 12
				
				already_delivered_qty = self.get_already_delivered_qty(obj.doc.name, 
					d.against_sales_order, d.prevdoc_detail_docname)
				so_qty, reserved_warehouse = self.get_so_qty_and_warehouse(d.prevdoc_detail_docname)
				
				if already_delivered_qty + d.qty > so_qty:
					reserved_qty_for_main_item = -(so_qty - already_delivered_qty)
				else:
					reserved_qty_for_main_item = -flt(d.qty)

			if self.has_sales_bom(d.item_code):
				for p in getlist(obj.doclist, 'packing_details'):
					if p.parent_detail_docname == d.name and p.parent_item == d.item_code:
						# the packing details table's qty is already multiplied with parent's qty
						il.append(webnotes._dict({
							'warehouse': p.warehouse,
							'reserved_warehouse': reserved_warehouse,
							'item_code': p.item_code,
							'qty': flt(p.qty),
							'reserved_qty': (flt(p.qty)/flt(d.qty)) * reserved_qty_for_main_item,
							'uom': p.uom,
							'batch_no': cstr(p.batch_no).strip(),
							'serial_no': cstr(p.serial_no).strip(),
							'name': d.name
						}))
			else:
				il.append(webnotes._dict({
					'warehouse': d.warehouse,
					'reserved_warehouse': reserved_warehouse,
					'item_code': d.item_code,
					'qty': d.qty,
					'reserved_qty': reserved_qty_for_main_item,
					'uom': d.stock_uom,
					'batch_no': cstr(d.batch_no).strip(),
					'serial_no': cstr(d.serial_no).strip(),
					'name': d.name
				}))
		return il
开发者ID:mxmo-co,项目名称:erpnext,代码行数:57,代码来源:sales_common.py


示例11: update_current_stock

	def update_current_stock(self):
		for d in getlist(self.doclist, 'delivery_note_details'):
			bin = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
			d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0

		for d in getlist(self.doclist, 'packing_details'):
			bin = webnotes.conn.sql("select actual_qty, projected_qty from `tabBin` where item_code =	%s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
			d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0
			d.projected_qty = bin and flt(bin[0]['projected_qty']) or 0
开发者ID:LPlusPlus,项目名称:erpnext,代码行数:9,代码来源:delivery_note.py


示例12: check_serial_no_added

	def check_serial_no_added(self):
		serial_present =[]
		for d in getlist(self.doclist, 'item_maintenance_detail'):
			if d.serial_no:
				serial_present.append(d.item_code)
		
		for m in getlist(self.doclist, 'maintenance_schedule_detail'):
			if serial_present:
				if m.item_code in serial_present and not m.serial_no:
					msgprint("Please click on 'Generate Schedule' to fetch serial no added for item "+m.item_code)
					raise Exception
开发者ID:Jdfkat,项目名称:erpnext,代码行数:11,代码来源:maintenance_schedule.py


示例13: update_sample_status

	def update_sample_status(self):
		samples, dic = {}, {}
		for sample in getlist(self.doclist, 'sample_allocation_detail'):
			#samples[sample.get('sample_no')] = ''
			self.test_allocation(sample, dic)

		self.prepare_escape_test(dic)

		#for updation of status in Sample Doctype
		for sample in getlist(self.doclist,'sample_allocation_detail'):
			webnotes.conn.sql("update tabSample set status = 'Assigned' where name ='"+sample.sample_no+"'")
			webnotes.conn.sql("commit")
开发者ID:saurabh6790,项目名称:tru_app_back,代码行数:12,代码来源:sample_allocation.py


示例14: get_finaltest_details

	def get_finaltest_details(self):
		self.doclist=self.doc.clear_table(self.doclist,'final_test')

		for d in getlist(self.doclist, 'test_allocation_detail'):

			for t in getlist(self.doclist,'test'):
				#webnotes.errprint(t)
				cr =addchild(self.doc,'final_test','Final Test Allocation Detail',self.doclist)
				cr.sample_no=d.sample_no
				cr.bottle_no=d.bottle_no
				cr.priority=d.priority
				cr.specification=d.specification
				cr.client_name=d.client_name
				cr.test=t.test_name
				cr.save(new=1)
开发者ID:saurabh6790,项目名称:tru_app_back,代码行数:15,代码来源:test_allocation_interface.py


示例15: on_update

	def on_update(self):
		if cint(self.doc.update_stock) == 1:
			# Set default warehouse from pos setting
			if cint(self.doc.is_pos) == 1:
				w = self.get_warehouse()
				if w:
					for d in getlist(self.doclist, 'entries'):
						if not d.warehouse:
							d.warehouse = cstr(w)

			self.make_packing_list()
		else:
			self.doclist = self.doc.clear_table(self.doclist, 'packing_details')
			
		if cint(self.doc.is_pos) == 1:
			if flt(self.doc.paid_amount) == 0:
				if self.doc.cash_bank_account: 
					webnotes.conn.set(self.doc, 'paid_amount', 
						(flt(self.doc.grand_total) - flt(self.doc.write_off_amount)))
				else:
					# show message that the amount is not paid
					webnotes.conn.set(self.doc,'paid_amount',0)
					webnotes.msgprint("Note: Payment Entry will not be created since 'Cash/Bank Account' was not specified.")
		else:
			webnotes.conn.set(self.doc,'paid_amount',0)
开发者ID:rajatkapoor,项目名称:erpnext,代码行数:25,代码来源:sales_invoice.py


示例16: set_against_income_account

	def set_against_income_account(self):
		"""Set against account for debit to account"""
		against_acc = []
		for d in getlist(self.doclist, 'entries'):
			if d.income_account not in against_acc:
				against_acc.append(d.income_account)
		self.doc.against_income_account = ','.join(against_acc)
开发者ID:rajatkapoor,项目名称:erpnext,代码行数:7,代码来源:sales_invoice.py


示例17: update_against_document_in_jv

	def update_against_document_in_jv(self):
		"""
			Links invoice and advance voucher:
				1. cancel advance voucher
				2. split into multiple rows if partially adjusted, assign against voucher
				3. submit advance voucher
		"""
		
		lst = []
		for d in getlist(self.doclist, 'advance_adjustment_details'):
			if flt(d.allocated_amount) > 0:
				args = {
					'voucher_no' : d.journal_voucher, 
					'voucher_detail_no' : d.jv_detail_no, 
					'against_voucher_type' : 'Sales Invoice', 
					'against_voucher'  : self.doc.name,
					'account' : self.doc.debit_to, 
					'is_advance' : 'Yes', 
					'dr_or_cr' : 'credit', 
					'unadjusted_amt' : flt(d.advance_amount),
					'allocated_amt' : flt(d.allocated_amount)
				}
				lst.append(args)
		
		if lst:
			from accounts.utils import reconcile_against_document
			reconcile_against_document(lst)
开发者ID:rajatkapoor,项目名称:erpnext,代码行数:27,代码来源:sales_invoice.py


示例18: pr_required

	def pr_required(self):
		res = sql("select value from `tabSingles` where doctype = 'Global Defaults' and field = 'pr_required'")
		if res and res[0][0] == 'Yes':
			 for d in getlist(self.doclist,'entries'):
				 if not d.purchase_receipt:
					 msgprint("Purchase Receipt No. required against item %s"%d.item_code)
					 raise Exception
开发者ID:alnguyenngoc,项目名称:erpnext,代码行数:7,代码来源:purchase_invoice.py


示例19: validate_inspection

	def validate_inspection(self):
		for d in getlist(self.doclist, 'purchase_receipt_details'):		 #Enter inspection date for all items that require inspection
			ins_reqd = webnotes.conn.sql("select inspection_required from `tabItem` where name = %s",
				(d.item_code,), as_dict = 1)
			ins_reqd = ins_reqd and ins_reqd[0]['inspection_required'] or 'No'
			if ins_reqd == 'Yes' and not d.qa_no:
				msgprint("Item: " + d.item_code + " requires QA Inspection. Please enter QA No or report to authorized person to create Quality Inspection")
开发者ID:rohitw1991,项目名称:innoworth-app,代码行数:7,代码来源:purchase_receipt.py


示例20: update_stock

	def update_stock(self):
		sl_entries = []
		stock_items = self.get_stock_items()
		
		for d in getlist(self.doclist, 'purchase_receipt_details'):
			if d.item_code in stock_items and d.warehouse:
				pr_qty = flt(d.qty) * flt(d.conversion_factor)
				
				if pr_qty:
					sl_entries.append(self.get_sl_entries(d, {
						"actual_qty": flt(pr_qty),
						"serial_no": cstr(d.serial_no).strip(),
						"incoming_rate": d.valuation_rate
					}))
				
				if flt(d.rejected_qty) > 0:
					sl_entries.append(self.get_sl_entries(d, {
						"warehouse": d.rejected_warehouse,
						"actual_qty": flt(d.rejected_qty) * flt(d.conversion_factor),
						"serial_no": cstr(d.rejected_serial_no).strip(),
						"incoming_rate": d.valuation_rate
					}))
						
		self.bk_flush_supp_wh(sl_entries)
		self.make_sl_entries(sl_entries)
开发者ID:rohitw1991,项目名称:innoworth-app,代码行数:25,代码来源:purchase_receipt.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python code.get_obj函数代码示例发布时间:2022-05-26
下一篇:
Python model.delete_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