Merge pull request #2317 from nabinhait/stock_reco
repost stock utility
This commit is contained in:
commit
476c613ba6
@ -7,7 +7,7 @@ from frappe.utils import flt
|
||||
|
||||
def execute():
|
||||
from erpnext.utilities.repost_stock import repost
|
||||
repost(allow_zero_rate=True)
|
||||
repost(allow_zero_rate=True, only_actual=True)
|
||||
|
||||
warehouse_account = frappe.db.sql("""select name, master_name from tabAccount
|
||||
where ifnull(account_type, '') = 'Warehouse'""")
|
||||
|
@ -9,7 +9,7 @@ from erpnext.stock.utils import update_bin
|
||||
from erpnext.stock.stock_ledger import update_entries_after
|
||||
from erpnext.accounts.utils import get_fiscal_year
|
||||
|
||||
def repost(allow_negative_stock=False, allow_zero_rate=False):
|
||||
def repost(only_actual=False, allow_negative_stock=False, allow_zero_rate=False):
|
||||
"""
|
||||
Repost everything!
|
||||
"""
|
||||
@ -23,7 +23,7 @@ def repost(allow_negative_stock=False, allow_zero_rate=False):
|
||||
union
|
||||
select item_code, warehouse from `tabStock Ledger Entry`) a"""):
|
||||
try:
|
||||
repost_stock(d[0], d[1], allow_zero_rate)
|
||||
repost_stock(d[0], d[1], allow_zero_rate, only_actual)
|
||||
frappe.db.commit()
|
||||
except:
|
||||
frappe.db.rollback()
|
||||
@ -33,10 +33,10 @@ def repost(allow_negative_stock=False, allow_zero_rate=False):
|
||||
frappe.db.get_value("Stock Settings", None, "allow_negative_stock"))
|
||||
frappe.db.auto_commit_on_many_writes = 0
|
||||
|
||||
def repost_stock(item_code, warehouse, allow_zero_rate=False):
|
||||
def repost_stock(item_code, warehouse, allow_zero_rate=False, only_actual=False):
|
||||
repost_actual_qty(item_code, warehouse, allow_zero_rate)
|
||||
|
||||
if item_code and warehouse:
|
||||
if item_code and warehouse and not only_actual:
|
||||
update_bin_qty(item_code, warehouse, {
|
||||
"reserved_qty": get_reserved_qty(item_code, warehouse),
|
||||
"indented_qty": get_indented_qty(item_code, warehouse),
|
||||
|
Loading…
Reference in New Issue
Block a user