removed has_key, used pythonic in (#13236)

* removed has_key, used pythonic in

* Update bom.py
This commit is contained in:
Achilles Rasquinha 2018-03-09 12:35:47 +05:30 committed by Rushabh Mehta
parent f2d28ebd6a
commit b4de7e3d07
5 changed files with 7 additions and 7 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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
@ -653,4 +653,4 @@ def get_boms_in_bottom_up_order(bom_no=None):
bom_list.append(child_bom)
count += 1
return bom_list
return bom_list

View File

@ -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)

View File

@ -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())