removed has_key, used pythonic in (#13236)
* removed has_key, used pythonic in * Update bom.py
This commit is contained in:
parent
f2d28ebd6a
commit
b4de7e3d07
@ -179,7 +179,7 @@ def get_invoice_tax_map(invoice_list, invoice_expense_map, expense_accounts):
|
||||
invoice_tax_map = {}
|
||||
for d in tax_details:
|
||||
if d.account_head in expense_accounts:
|
||||
if invoice_expense_map[d.parent].has_key(d.account_head):
|
||||
if d.account_head in invoice_expense_map[d.parent]:
|
||||
invoice_expense_map[d.parent][d.account_head] += flt(d.tax_amount)
|
||||
else:
|
||||
invoice_expense_map[d.parent][d.account_head] = flt(d.tax_amount)
|
||||
|
@ -189,7 +189,7 @@ def get_invoice_tax_map(invoice_list, invoice_income_map, income_accounts):
|
||||
invoice_tax_map = {}
|
||||
for d in tax_details:
|
||||
if d.account_head in income_accounts:
|
||||
if invoice_income_map[d.parent].has_key(d.account_head):
|
||||
if d.account_head in invoice_income_map[d.parent]:
|
||||
invoice_income_map[d.parent][d.account_head] += flt(d.tax_amount)
|
||||
else:
|
||||
invoice_income_map[d.parent][d.account_head] = flt(d.tax_amount)
|
||||
|
@ -573,7 +573,7 @@ def get_bom_items_as_dict(bom, company, qty=1, fetch_exploded=1, fetch_scrap_ite
|
||||
items = frappe.db.sql(query, { "qty": qty, "bom": bom }, as_dict=True)
|
||||
|
||||
for item in items:
|
||||
if item_dict.has_key(item.item_code):
|
||||
if item.item_code in item_dict:
|
||||
item_dict[item.item_code]["qty"] += flt(item.qty)
|
||||
else:
|
||||
item_dict[item.item_code] = item
|
||||
|
@ -32,10 +32,10 @@ class MaterialRequest(BuyingController):
|
||||
so_items = {} # Format --> {'SO/00001': {'Item/001': 120, 'Item/002': 24}}
|
||||
for d in self.get('items'):
|
||||
if d.sales_order:
|
||||
if not so_items.has_key(d.sales_order):
|
||||
if not d.sales_order in so_items:
|
||||
so_items[d.sales_order] = {d.item_code: flt(d.qty)}
|
||||
else:
|
||||
if not so_items[d.sales_order].has_key(d.item_code):
|
||||
if not d.item_code in so_items[d.sales_order]:
|
||||
so_items[d.sales_order][d.item_code] = flt(d.qty)
|
||||
else:
|
||||
so_items[d.sales_order][d.item_code] += flt(d.qty)
|
||||
|
@ -43,7 +43,7 @@ def get_stock_value_on(warehouse=None, posting_date=None, item_code=None):
|
||||
|
||||
sle_map = {}
|
||||
for sle in stock_ledger_entries:
|
||||
if not sle_map.has_key((sle.item_code, sle.warehouse)):
|
||||
if not (sle.item_code, sle.warehouse) in sle_map:
|
||||
sle_map[(sle.item_code, sle.warehouse)] = flt(sle.stock_value)
|
||||
|
||||
return sum(sle_map.values())
|
||||
|
Loading…
x
Reference in New Issue
Block a user