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 = {}
|
invoice_tax_map = {}
|
||||||
for d in tax_details:
|
for d in tax_details:
|
||||||
if d.account_head in expense_accounts:
|
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)
|
invoice_expense_map[d.parent][d.account_head] += flt(d.tax_amount)
|
||||||
else:
|
else:
|
||||||
invoice_expense_map[d.parent][d.account_head] = flt(d.tax_amount)
|
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 = {}
|
invoice_tax_map = {}
|
||||||
for d in tax_details:
|
for d in tax_details:
|
||||||
if d.account_head in income_accounts:
|
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)
|
invoice_income_map[d.parent][d.account_head] += flt(d.tax_amount)
|
||||||
else:
|
else:
|
||||||
invoice_income_map[d.parent][d.account_head] = flt(d.tax_amount)
|
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)
|
items = frappe.db.sql(query, { "qty": qty, "bom": bom }, as_dict=True)
|
||||||
|
|
||||||
for item in items:
|
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)
|
item_dict[item.item_code]["qty"] += flt(item.qty)
|
||||||
else:
|
else:
|
||||||
item_dict[item.item_code] = item
|
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)
|
bom_list.append(child_bom)
|
||||||
count += 1
|
count += 1
|
||||||
|
|
||||||
return bom_list
|
return bom_list
|
||||||
|
@ -32,10 +32,10 @@ class MaterialRequest(BuyingController):
|
|||||||
so_items = {} # Format --> {'SO/00001': {'Item/001': 120, 'Item/002': 24}}
|
so_items = {} # Format --> {'SO/00001': {'Item/001': 120, 'Item/002': 24}}
|
||||||
for d in self.get('items'):
|
for d in self.get('items'):
|
||||||
if d.sales_order:
|
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)}
|
so_items[d.sales_order] = {d.item_code: flt(d.qty)}
|
||||||
else:
|
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)
|
so_items[d.sales_order][d.item_code] = flt(d.qty)
|
||||||
else:
|
else:
|
||||||
so_items[d.sales_order][d.item_code] += flt(d.qty)
|
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 = {}
|
sle_map = {}
|
||||||
for sle in stock_ledger_entries:
|
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)
|
sle_map[(sle.item_code, sle.warehouse)] = flt(sle.stock_value)
|
||||||
|
|
||||||
return sum(sle_map.values())
|
return sum(sle_map.values())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user