fix(stock): Update batch quantity whenever stock in it is moved

This commit is contained in:
Rohan Bansal 2019-04-26 17:10:44 +05:30 committed by Nabin Hait
parent 1bd7ea99f4
commit 4a50c99867

View File

@ -38,6 +38,11 @@ class StockLedgerEntry(Document):
self.check_stock_frozen_date()
self.actual_amt_check()
if self.batch_no:
batch = frappe.get_doc("Batch", self.batch_no)
batch.calculate_batch_qty()
batch.save()
if not self.get("via_landed_cost_voucher"):
from erpnext.stock.doctype.serial_no.serial_no import process_serial_no
process_serial_no(self)
@ -139,4 +144,3 @@ def on_doctype_update():
frappe.db.add_index("Stock Ledger Entry", ["voucher_no", "voucher_type"])
frappe.db.add_index("Stock Ledger Entry", ["batch_no", "item_code", "warehouse"])