mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-05 21:29:11 +00:00
style: format code with black
This commit is contained in:
@@ -11,7 +11,8 @@ def execute():
|
||||
for doctype in ("Sales Order Item", "Bin"):
|
||||
frappe.reload_doctype(doctype)
|
||||
|
||||
repost_for = frappe.db.sql("""
|
||||
repost_for = frappe.db.sql(
|
||||
"""
|
||||
select
|
||||
distinct item_code, warehouse
|
||||
from
|
||||
@@ -26,17 +27,18 @@ def execute():
|
||||
) so_item
|
||||
where
|
||||
exists(select name from tabItem where name=so_item.item_code and ifnull(is_stock_item, 0)=1)
|
||||
""")
|
||||
"""
|
||||
)
|
||||
|
||||
for item_code, warehouse in repost_for:
|
||||
if not (item_code and warehouse):
|
||||
continue
|
||||
update_bin_qty(item_code, warehouse, {
|
||||
"reserved_qty": get_reserved_qty(item_code, warehouse)
|
||||
})
|
||||
update_bin_qty(item_code, warehouse, {"reserved_qty": get_reserved_qty(item_code, warehouse)})
|
||||
|
||||
frappe.db.sql("""delete from tabBin
|
||||
frappe.db.sql(
|
||||
"""delete from tabBin
|
||||
where exists(
|
||||
select name from tabItem where name=tabBin.item_code and ifnull(is_stock_item, 0) = 0
|
||||
)
|
||||
""")
|
||||
"""
|
||||
)
|
||||
|
||||
@@ -8,20 +8,26 @@ import frappe
|
||||
def execute():
|
||||
from erpnext.stock.stock_balance import get_indented_qty, get_ordered_qty, update_bin_qty
|
||||
|
||||
count=0
|
||||
for item_code, warehouse in frappe.db.sql("""select distinct item_code, warehouse from
|
||||
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:
|
||||
if not (item_code and warehouse):
|
||||
continue
|
||||
count += 1
|
||||
update_bin_qty(item_code, warehouse, {
|
||||
select item_code, warehouse from `tabStock Ledger Entry`) a"""
|
||||
):
|
||||
try:
|
||||
if not (item_code and warehouse):
|
||||
continue
|
||||
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 Exception:
|
||||
frappe.db.rollback()
|
||||
"ordered_qty": get_ordered_qty(item_code, warehouse),
|
||||
},
|
||||
)
|
||||
if count % 200 == 0:
|
||||
frappe.db.commit()
|
||||
except Exception:
|
||||
frappe.db.rollback()
|
||||
|
||||
Reference in New Issue
Block a user