예제 #1
0
def execute():
	from erpnext.utilities.repost_stock import update_bin_qty, get_indented_qty

	count=0
	for item_code, warehouse in frappe.db.sql("""select distinct item_code, warehouse 
		from `tabMaterial Request Item` where docstatus = 1"""):
			try:
				count += 1
				update_bin_qty(item_code, warehouse, {
					"indented_qty": get_indented_qty(item_code, warehouse),
				})
				if count % 200 == 0:
					frappe.db.commit()
			except:
				frappe.db.rollback()
def execute():
	from erpnext.utilities.repost_stock import update_bin_qty, get_indented_qty, get_ordered_qty

	count=0
	for item_code, warehouse in frappe.db.sql("""select distinct item_code, warehouse from
		(select item_code, warehouse from tabBin
		union
		select item_code, warehouse from `tabStock Ledger Entry`) a"""):
			try:
				count += 1
				update_bin_qty(item_code, warehouse, {
					"indented_qty": get_indented_qty(item_code, warehouse),
					"ordered_qty": get_ordered_qty(item_code, warehouse)
				})
				if count % 200 == 0:
					frappe.db.commit()
			except:
				frappe.db.rollback()
def execute():
    from erpnext.utilities.repost_stock import update_bin_qty, get_indented_qty, get_ordered_qty

    count = 0
    for item_code, warehouse in frappe.db.sql(
            """select distinct item_code, warehouse from
		(select item_code, warehouse from tabBin
		union
		select item_code, warehouse from `tabStock Ledger Entry`) a"""):
        try:
            count += 1
            update_bin_qty(
                item_code, warehouse, {
                    "indented_qty": get_indented_qty(item_code, warehouse),
                    "ordered_qty": get_ordered_qty(item_code, warehouse)
                })
            if count % 200 == 0:
                frappe.db.commit()
        except:
            frappe.db.rollback()