refactor: replace misleading variable name

(cherry picked from commit 97060c45e9)
This commit is contained in:
Ankush Menat
2021-12-03 11:50:38 +05:30
committed by Ankush Menat
parent 09f0e9be86
commit a9bf4ad8fa
2 changed files with 6 additions and 6 deletions

View File

@@ -795,10 +795,10 @@ class update_entries_after(object):
def update_bin(self):
# update bin for each warehouse
for warehouse, data in iteritems(self.data):
bin_record = get_or_make_bin(self.item_code, warehouse)
for warehouse, data in self.data.items():
bin_name = get_or_make_bin(self.item_code, warehouse)
frappe.db.set_value('Bin', bin_record, {
frappe.db.set_value('Bin', bin_name, {
"valuation_rate": data.valuation_rate,
"actual_qty": data.qty_after_transaction,
"stock_value": data.stock_value

View File

@@ -188,7 +188,7 @@ def get_bin(item_code, warehouse):
bin_obj.flags.ignore_permissions = True
return bin_obj
def get_or_make_bin(item_code, warehouse) -> str:
def get_or_make_bin(item_code: str , warehouse: str) -> str:
bin_record = frappe.db.get_value('Bin', {'item_code': item_code, 'warehouse': warehouse})
if not bin_record:
@@ -207,8 +207,8 @@ def update_bin(args, allow_negative_stock=False, via_landed_cost_voucher=False):
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_record = get_or_make_bin(args.get("item_code"), args.get("warehouse"))
update_stock(bin_record, args, allow_negative_stock, via_landed_cost_voucher)
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")))