diff --git a/erpnext/stock/doctype/bin/bin.py b/erpnext/stock/doctype/bin/bin.py index d2bae652390..3bc15a80250 100644 --- a/erpnext/stock/doctype/bin/bin.py +++ b/erpnext/stock/doctype/bin/bin.py @@ -20,18 +20,6 @@ class Bin(Document): + flt(self.indented_qty) + flt(self.planned_qty) - flt(self.reserved_qty) - flt(self.reserved_qty_for_production) - flt(self.reserved_qty_for_sub_contract)) - def get_first_sle(self): - sle = frappe.qb.DocType("Stock Ledger Entry") - first_sle = ( - frappe.qb.from_(sle) - .select("*") - .where((sle.item_code == self.item_code) & (sle.warehouse == self.warehouse)) - .orderby(sle.posting_date, sle.posting_time, sle.creation) - .limit(1) - ).run(as_dict=True) - - return first_sle and first_sle[0] or None - def update_reserved_qty_for_production(self): '''Update qty reserved for production from Production Item tables in open work orders''' @@ -107,13 +95,6 @@ def on_doctype_update(): frappe.db.add_unique("Bin", ["item_code", "warehouse"], constraint_name="unique_item_warehouse") -def update_stock(bin_name, args, allow_negative_stock=False, via_landed_cost_voucher=False): - """WARNING: This function is deprecated. Inline this function instead of using it.""" - from erpnext.stock.stock_ledger import repost_current_voucher - - repost_current_voucher(args, allow_negative_stock, via_landed_cost_voucher) - update_qty(bin_name, args) - def get_bin_details(bin_name): return frappe.db.get_value('Bin', bin_name, ['actual_qty', 'ordered_qty', 'reserved_qty', 'indented_qty', 'planned_qty', 'reserved_qty_for_production', diff --git a/erpnext/stock/stock_balance.py b/erpnext/stock/stock_balance.py index 6663458e651..10a14b9d8d8 100644 --- a/erpnext/stock/stock_balance.py +++ b/erpnext/stock/stock_balance.py @@ -6,7 +6,6 @@ import frappe from frappe.utils import cstr, flt, nowdate, nowtime from erpnext.controllers.stock_controller import create_repost_item_valuation_entry -from erpnext.stock.utils import update_bin def repost(only_actual=False, allow_negative_stock=False, allow_zero_rate=False, only_bin=False): @@ -227,8 +226,6 @@ def set_stock_balance_as_per_serial_no(item_code=None, posting_date=None, postin "sle_id": sle_doc.name }) - update_bin(args) - create_repost_item_valuation_entry({ "item_code": d[0], "warehouse": d[1], diff --git a/erpnext/stock/utils.py b/erpnext/stock/utils.py index c75c737fc5a..7263e39cc9f 100644 --- a/erpnext/stock/utils.py +++ b/erpnext/stock/utils.py @@ -206,16 +206,6 @@ def _create_bin(item_code, warehouse): return bin_obj -def update_bin(args, allow_negative_stock=False, via_landed_cost_voucher=False): - """WARNING: This function is deprecated. Inline this function instead of using it.""" - from erpnext.stock.doctype.bin.bin import update_stock - is_stock_item = frappe.get_cached_value('Item', args.get("item_code"), 'is_stock_item') - if is_stock_item: - bin_name = get_or_make_bin(args.get("item_code"), args.get("warehouse")) - update_stock(bin_name, args, allow_negative_stock, via_landed_cost_voucher) - else: - frappe.msgprint(_("Item {0} ignored since it is not a stock item").format(args.get("item_code"))) - @frappe.whitelist() def get_incoming_rate(args, raise_error_if_no_rate=True): """Get Incoming Rate based on valuation method"""