Beispiel #1
0
def execute():
	webnotes.conn.auto_commit_on_many_writes = 1
	from utilities.repost_stock import repost_stock
	for d in webnotes.conn.sql("""select distinct production_item, fg_warehouse 
		from `tabProduction Order` where docstatus>0""", as_dict=1):
			repost_stock(d.production_item, d.fg_warehouse)
			
	webnotes.conn.auto_commit_on_many_writes = 0
Beispiel #2
0
def execute():
    webnotes.conn.auto_commit_on_many_writes = 1
    from utilities.repost_stock import repost_stock
    for d in webnotes.conn.sql(
            """select distinct production_item, fg_warehouse 
		from `tabProduction Order` where docstatus>0""",
            as_dict=1):
        repost_stock(d.production_item, d.fg_warehouse)

    webnotes.conn.auto_commit_on_many_writes = 0
Beispiel #3
0
	def recalculate_bin_qty(self, newdn):
		from utilities.repost_stock import repost_stock
		webnotes.conn.auto_commit_on_many_writes = 1
		webnotes.conn.set_default("allow_negative_stock", 1)
		
		for warehouse in webnotes.conn.sql("select name from `tabWarehouse`"):
			repost_stock(newdn, warehouse[0])
		
		webnotes.conn.set_default("allow_negative_stock", 
			webnotes.conn.get_value("Stock Settings", None, "allow_negative_stock"))
		webnotes.conn.auto_commit_on_many_writes = 0
Beispiel #4
0
    def recalculate_bin_qty(self, newdn):
        from utilities.repost_stock import repost_stock
        webnotes.conn.auto_commit_on_many_writes = 1
        webnotes.conn.set_default("allow_negative_stock", 1)

        for warehouse in webnotes.conn.sql("select name from `tabWarehouse`"):
            repost_stock(newdn, warehouse[0])

        webnotes.conn.set_default(
            "allow_negative_stock",
            webnotes.conn.get_value("Stock Settings", None,
                                    "allow_negative_stock"))
        webnotes.conn.auto_commit_on_many_writes = 0
Beispiel #5
0
	def recalculate_bin_qty(self, newdn):
		from utilities.repost_stock import repost_stock
		webnotes.conn.auto_commit_on_many_writes = 1
		webnotes.conn.set_default("allow_negative_stock", 1)
		
		for item in webnotes.conn.sql("""select distinct item_code from (
			select name as item_code from `tabItem` where ifnull(is_stock_item, 'Yes')='Yes'
			union 
			select distinct item_code from tabBin) a"""):
				repost_stock(item[0], newdn)
			
		webnotes.conn.set_default("allow_negative_stock", 
			webnotes.conn.get_value("Stock Settings", None, "allow_negative_stock"))
		webnotes.conn.auto_commit_on_many_writes = 0
Beispiel #6
0
    def recalculate_bin_qty(self, newdn):
        from utilities.repost_stock import repost_stock
        webnotes.conn.auto_commit_on_many_writes = 1
        webnotes.conn.set_default("allow_negative_stock", 1)

        for item in webnotes.conn.sql("""select distinct item_code from (
			select name as item_code from `tabItem` where ifnull(is_stock_item, 'Yes')='Yes'
			union 
			select distinct item_code from tabBin) a"""):
            repost_stock(item[0], newdn)

        webnotes.conn.set_default(
            "allow_negative_stock",
            webnotes.conn.get_value("Stock Settings", None,
                                    "allow_negative_stock"))
        webnotes.conn.auto_commit_on_many_writes = 0
def execute():
	from utilities.repost_stock import repost_stock
	
	webnotes.conn.sql("""delete from tabBin 
		where ifnull(item_code, '') = '' or ifnull(warehouse, '')=''""")
	
	webnotes.conn.auto_commit_on_many_writes = 1
	
	for d in webnotes.conn.sql("""select item_code, warehouse, count(*) as count from tabBin 
		group by item_code, warehouse""", as_dict=1):
			if d.count > 1:
				webnotes.conn.sql("""delete from tabBin where item_code=%s 
					and warehouse=%s limit %s""", (d.item_code, d.warehouse, d.count-1))
				repost_stock(d.item_code, d.warehouse)
				
	webnotes.conn.auto_commit_on_many_writes = 0
Beispiel #8
0
def execute():
    from utilities.repost_stock import repost_stock

    webnotes.conn.sql("""delete from tabBin 
		where ifnull(item_code, '') = '' or ifnull(warehouse, '')=''""")

    webnotes.conn.auto_commit_on_many_writes = 1

    for d in webnotes.conn.sql(
            """select item_code, warehouse, count(*) as count from tabBin 
		group by item_code, warehouse""",
            as_dict=1):
        if d.count > 1:
            webnotes.conn.sql(
                """delete from tabBin where item_code=%s 
					and warehouse=%s limit %s""", (d.item_code, d.warehouse, d.count - 1))
            repost_stock(d.item_code, d.warehouse)

    webnotes.conn.auto_commit_on_many_writes = 0