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


Python stock_ledger.update_entries_after函数代码示例

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


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

示例1: execute

def execute():
	webnotes.conn.auto_commit_on_many_writes = 1
	
	pr_items = webnotes.conn.sql("""select item_code, warehouse, serial_no, valuation_rate, name 
		from `tabPurchase Receipt Item` where ifnull(serial_no, '') != '' and docstatus = 1""", 
		as_dict=True)
		
	item_warehouse = []
		
	for item in pr_items:
		serial_nos = cstr(item.serial_no).strip().split("\n")
		serial_nos = map(lambda x: x.strip(), serial_nos)

		if cstr(item.serial_no) != "\n".join(serial_nos):
			webnotes.conn.sql("""update `tabPurchase Receipt Item` set serial_no = %s 
				where name = %s""", ("\n".join(serial_nos), item.name))
			
			if [item.item_code, item.warehouse] not in item_warehouse:
				item_warehouse.append([item.item_code, item.warehouse])
		
			webnotes.conn.sql("""update `tabSerial No` set purchase_rate = %s 
				where name in (%s)""" % ('%s', ', '.join(['%s']*len(serial_nos))), 
				tuple([item.valuation_rate] + serial_nos))

	for d in item_warehouse:
		try:
			update_entries_after({"item_code": d[0], "warehouse": d[1] })
		except:
			continue
			
	webnotes.conn.auto_commit_on_many_writes = 0
开发者ID:BANSALJEE,项目名称:erpnext,代码行数:31,代码来源:p01_update_serial_no_valuation_rate.py

示例2: execute

def execute():
	from stock.stock_ledger import update_entries_after
	item_warehouse = []
	# update valuation_rate in transaction
	doctypes = {"Purchase Receipt": "purchase_receipt_details", "Purchase Invoice": "entries"}
	
	for dt in doctypes:
		for d in webnotes.conn.sql("""select name from `tab%s` 
				where modified >= '2013-05-09' and docstatus=1""" % dt):
			rec = webnotes.get_obj(dt, d[0])
			rec.update_valuation_rate(doctypes[dt])
			
			for item in rec.doclist.get({"parentfield": doctypes[dt]}):
				webnotes.conn.sql("""update `tab%s Item` set valuation_rate = %s 
					where name = %s"""% (dt, '%s', '%s'), tuple([item.valuation_rate, item.name]))
					
				if dt == "Purchase Receipt":
					webnotes.conn.sql("""update `tabStock Ledger Entry` set incoming_rate = %s 
						where voucher_detail_no = %s""", (item.valuation_rate, item.name))
					if [item.item_code, item.warehouse] not in item_warehouse:
						item_warehouse.append([item.item_code, item.warehouse])
			
	for d in item_warehouse:
		try:
			update_entries_after({"item_code": d[0], "warehouse": d[1], 
				"posting_date": "2013-01-01", "posting_time": "00:05:00"})
			webnotes.conn.commit()
		except:
			pass
开发者ID:Anirudh887,项目名称:erpnext,代码行数:29,代码来源:p02_update_valuation_rate.py

示例3: update_stock_ledger_entry

    def update_stock_ledger_entry(self):
        # update stock ledger entry
        from stock.stock_ledger import update_entries_after

        if flt(self.doc.conversion_factor) != flt(1):
            sql(
                "update `tabStock Ledger Entry` set stock_uom = '%s', actual_qty = ifnull(actual_qty,0) * '%s' where item_code = '%s' "
                % (self.doc.new_stock_uom, self.doc.conversion_factor, self.doc.item_code)
            )
        else:
            sql(
                "update `tabStock Ledger Entry` set stock_uom = '%s' where item_code = '%s' "
                % (self.doc.new_stock_uom, self.doc.item_code)
            )

            # acknowledge user
        msgprint("Stock Ledger Entries Updated Successfully.")

        # update item valuation
        if flt(self.doc.conversion_factor) != flt(1):
            wh = sql("select name from `tabWarehouse`")
            for w in wh:
                update_entries_after({"item_code": self.doc.item_code, "warehouse": w[0]})

                # acknowledge user
        msgprint("Item Valuation Updated Successfully.")
开发者ID:tejastank,项目名称:erpnext,代码行数:26,代码来源:stock_uom_replace_utility.py

示例4: repost_actual_qty

def repost_actual_qty(item_code, warehouse):
    from stock.stock_ledger import update_entries_after

    try:
        update_entries_after({"item_code": item_code, "warehouse": warehouse})
    except:
        pass
开发者ID:nabinhait,项目名称:erpnext,代码行数:7,代码来源:repost_stock.py

示例5: cleanup_wrong_sle

def cleanup_wrong_sle():
	sle = webnotes.conn.sql("""
		select item_code, warehouse, voucher_no, name
		from `tabStock Ledger Entry` sle
		where voucher_type = 'Delivery Note'
		and not exists(
			select name from `tabDelivery Note Packing Item` 
			where item_code = sle.item_code 
			and qty = abs(sle.actual_qty)
			and parent = sle.voucher_no
		) and not exists (
			select name from `tabDelivery Note Item` 
			where item_code = sle.item_code 
			and qty = abs(sle.actual_qty)
			and parent = sle.voucher_no
		)
	""")
	if sle:
		for d in sle:
			webnotes.conn.sql("update `tabStock Ledger Entry` set is_cancelled = 'Yes' where name = %s", d[3])
			create_comment(d[3])
			update_entries_after({
				"item_code": d[0],
				"warehouse": d[1],
				"posting_date": "2012-07-01",
				"posting_time": "12:05"
			})
开发者ID:BANSALJEE,项目名称:erpnext,代码行数:27,代码来源:repost_stock_due_to_wrong_packing_list.py

示例6: update_sle

    def update_sle(self):
        """ Recalculate valuation rate in all sle after pr posting date"""
        from stock.stock_ledger import update_entries_after

        for pr in self.selected_pr:
            pr_obj = get_obj("Purchase Receipt", pr, with_children=1)

            for d in getlist(pr_obj.doclist, "purchase_receipt_details"):
                if flt(d.qty):
                    d.valuation_rate = (
                        flt(d.purchase_rate)
                        + (flt(d.rm_supp_cost) / flt(d.qty))
                        + (flt(d.item_tax_amount) / flt(d.qty))
                    ) / flt(d.conversion_factor)
                    d.save()
                    self.update_serial_no(d.serial_no, d.valuation_rate)
                sql(
                    "update `tabStock Ledger Entry` set incoming_rate = '%s' where voucher_detail_no = '%s'"
                    % (flt(d.valuation_rate), d.name)
                )

                res = sql(
                    """select item_code, warehouse, posting_date, posting_time 
					from `tabStock Ledger Entry` where voucher_detail_no = %s LIMIT 1""",
                    d.name,
                    as_dict=1,
                )

                # update valuation rate after pr posting date
                if res:
                    update_entries_after(res[0])
开发者ID:jnarvaezp,项目名称:erpnext,代码行数:31,代码来源:landed_cost_wizard.py

示例7: on_rename

	def on_rename(self, newdn, olddn, merge=False):
		webnotes.conn.set_value("Account", {"account_type": "Warehouse", "master_name": olddn}, 
			"master_name", newdn)
			
		if merge:
			from stock.stock_ledger import update_entries_after
			for item_code in webnotes.conn.sql("""select item_code from `tabBin` 
				where warehouse=%s""", newdn):
					update_entries_after({"item_code": item_code, "warehouse": newdn})
开发者ID:CarlosAnt,项目名称:erpnext,代码行数:9,代码来源:warehouse.py

示例8: on_rename

	def on_rename(self, newdn, olddn, merge=False):
		webnotes.conn.sql("update tabItem set item_code = %s where name = %s", (newdn, olddn))
		if self.doc.page_name:
			from webnotes.webutils import clear_cache
			clear_cache(self.doc.page_name)
			
		if merge:
			from stock.stock_ledger import update_entries_after
			for wh in webnotes.conn.sql("""select warehouse from `tabBin` 
				where item_code=%s""", newdn):
					update_entries_after({"item_code": newdn, "warehouse": wh[0]})
开发者ID:rajatkapoor,项目名称:erpnext,代码行数:11,代码来源:item.py

示例9: execute

def execute():
	import webnotes
	res = webnotes.conn.sql("""select distinct item_code, warehouse from `tabStock Ledger Entry`
	 	where posting_time > '00:00:00' and posting_time < '00:01:00'""", as_dict=1)
	webnotes.conn.sql("update `tabStock Ledger Entry` set posting_time = '00:00:00' where posting_time > '00:00:00' and posting_time < '00:01:00'")

	from stock.stock_ledger import update_entries_after
	for d in res:
		update_entries_after({
			"item_code": d.item_code,
			"warehouse": d.warehouse,
		})
开发者ID:BANSALJEE,项目名称:erpnext,代码行数:12,代码来源:repost_stock_for_posting_time.py

示例10: execute

def execute():
	import webnotes
	from stock.stock_ledger import update_entries_after
	res = webnotes.conn.sql("select distinct item_code, warehouse from `tabStock Ledger Entry`")
	i=0
	for d in res:
	    try:
			update_entries_after({ "item_code": d[0], "warehouse": d[1]})
	    except:
	        pass
	    i += 1
	    if i%100 == 0:
	        webnotes.conn.sql("commit")
	        webnotes.conn.sql("start transaction")
开发者ID:cocoy,项目名称:erpnext,代码行数:14,代码来源:repost_stock.py

示例11: execute

def execute():
	import webnotes
	from stock.stock_ledger import update_entries_after
	webnotes.conn.auto_commit_on_many_writes = 1
	
	res = webnotes.conn.sql("""select distinct sle.item_code, sle.warehouse 
		from `tabStock Ledger Entry` sle 
		where (select has_serial_no from tabItem where name=sle.item_code)='Yes'""")
	
	for d in res:
	    try:
			update_entries_after({ "item_code": d[0], "warehouse": d[1]})
	    except:
	        pass
			
	webnotes.conn.auto_commit_on_many_writes = 0
开发者ID:aproxp,项目名称:erpnext,代码行数:16,代码来源:repost_stock_for_serialized_item.py

示例12: update_stock

	def update_stock(self, args):
		self.update_qty(args)
		
		if args.get("actual_qty"):
			from stock.stock_ledger import update_entries_after
			
			if not args.get("posting_date"):
				args["posting_date"] = nowdate()
			
			# update valuation and qty after transaction for post dated entry
			update_entries_after({
				"item_code": self.doc.item_code,
				"warehouse": self.doc.warehouse,
				"posting_date": args.get("posting_date"),
				"posting_time": args.get("posting_time")
			})
开发者ID:CarlosAnt,项目名称:erpnext,代码行数:16,代码来源:bin.py

示例13: delete_stock_ledger_entries

	def delete_stock_ledger_entries(self):
		"""	Delete Stock Ledger Entries related to this Stock Reconciliation
			and repost future Stock Ledger Entries"""
					
		existing_entries = webnotes.conn.sql("""select item_code, warehouse 
			from `tabStock Ledger Entry` where voucher_type='Stock Reconciliation' 
			and voucher_no=%s""", self.doc.name, as_dict=1)
				
		# delete entries
		webnotes.conn.sql("""delete from `tabStock Ledger Entry` 
			where voucher_type='Stock Reconciliation' and voucher_no=%s""", self.doc.name)
		
		# repost future entries for selected item_code, warehouse
		for entries in existing_entries:
			update_entries_after({
				"item_code": entries.item_code,
				"warehouse": entries.warehouse,
				"posting_date": self.doc.posting_date,
				"posting_time": self.doc.posting_time
			})
开发者ID:PhamThoTam,项目名称:erpnext,代码行数:20,代码来源:stock_reconciliation.py

示例14: delete_and_repost_sle

	def delete_and_repost_sle(self):
		"""	Delete Stock Ledger Entries related to this voucher
			and repost future Stock Ledger Entries"""

		existing_entries = webnotes.conn.sql("""select distinct item_code, warehouse
			from `tabStock Ledger Entry` where voucher_type=%s and voucher_no=%s""",
			(self.doc.doctype, self.doc.name), as_dict=1)

		# delete entries
		webnotes.conn.sql("""delete from `tabStock Ledger Entry`
			where voucher_type=%s and voucher_no=%s""", (self.doc.doctype, self.doc.name))

		# repost future entries for selected item_code, warehouse
		for entries in existing_entries:
			update_entries_after({
				"item_code": entries.item_code,
				"warehouse": entries.warehouse,
				"posting_date": self.doc.posting_date,
				"posting_time": self.doc.posting_time
			})
开发者ID:aproxp,项目名称:erpnext,代码行数:20,代码来源:stock_reconciliation.py

示例15: on_rename

	def on_rename(self, newdn, olddn, merge=False):
		if merge:
			from stock.stock_ledger import update_entries_after
			for item_code in webnotes.conn.sql("""select item_code from `tabBin` 
				where warehouse=%s""", newdn):
					update_entries_after({"item_code": item_code, "warehouse": newdn})
开发者ID:frank1638,项目名称:erpnext,代码行数:6,代码来源:warehouse.py


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