diff --git a/accounts/report/budget_variance_report/budget_variance_report.py b/accounts/report/budget_variance_report/budget_variance_report.py index 0e241dea1d..652c1851a6 100644 --- a/accounts/report/budget_variance_report/budget_variance_report.py +++ b/accounts/report/budget_variance_report/budget_variance_report.py @@ -73,10 +73,10 @@ def get_costcenter_target_details(filters): def get_target_distribution_details(filters): target_details = {} - for d in webnotes.conn.sql("""select bd.name, bdd.month, bdd.percentage_allocation \ + for d in webnotes.conn.sql("""select bd.name, bdd.month, bdd.percentage_allocation from `tabBudget Distribution Detail` bdd, `tabBudget Distribution` bd where bdd.parent=bd.name and bd.fiscal_year=%s""", (filters["fiscal_year"]), as_dict=1): - target_details.setdefault(d.name, {}).setdefault(d.month, d.percentage_allocation) + target_details.setdefault(d.name, {}).setdefault(d.month, flt(d.percentage_allocation)) return target_details @@ -113,10 +113,11 @@ def get_costcenter_account_month_map(filters): })) tav_dict = cam_map[ccd.name][ccd.account][month] - month_percentage = ccd.distribution_id and \ - tdd.get(ccd.distribution_id, {}).get(month, 0) or 100.0/12 + + month_percentage = tdd.get(ccd.distribution_id, {}).get(month, 0) \ + if ccd.distribution_id else 100.0/12 - tav_dict.target = flt(ccd.budget_allocated) * month_percentage /100 + tav_dict.target = flt(ccd.budget_allocated) * month_percentage / 100 for ad in actual_details.get(ccd.name, {}).get(ccd.account, []): if ad.month_name == month: diff --git a/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py b/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py index ebb2d9f96f..8a4b9530f3 100644 --- a/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py +++ b/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py @@ -76,7 +76,7 @@ def get_target_distribution_details(filters): for d in webnotes.conn.sql("""select bd.name, bdd.month, bdd.percentage_allocation from `tabBudget Distribution Detail` bdd, `tabBudget Distribution` bd where bdd.parent=bd.name and bd.fiscal_year=%s""", (filters["fiscal_year"]), as_dict=1): - target_details.setdefault(d.name, {}).setdefault(d.month, d.percentage_allocation) + target_details.setdefault(d.name, {}).setdefault(d.month, flt(d.percentage_allocation)) return target_details @@ -115,8 +115,8 @@ def get_salesperson_item_month_map(filters): })) tav_dict = sim_map[sd.name][sd.item_group][month] - month_percentage = sd.distribution_id and \ - tdd.get(sd.distribution_id, {}).get(month, 0) or 100.0/12 + month_percentage = tdd.get(sd.distribution_id, {}).get(month, 0) \ + if sd.distribution_id else 100.0/12 for ad in achieved_details.get(sd.name, {}).get(sd.item_group, []): if (filters["target_on"] == "Quantity"): diff --git a/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.py b/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.py index 2aafe3c6bd..f3b480c206 100644 --- a/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.py +++ b/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.py @@ -73,7 +73,7 @@ def get_target_distribution_details(filters): for d in webnotes.conn.sql("""select bd.name, bdd.month, bdd.percentage_allocation from `tabBudget Distribution Detail` bdd, `tabBudget Distribution` bd where bdd.parent=bd.name and bd.fiscal_year=%s""", (filters["fiscal_year"]), as_dict=1): - target_details.setdefault(d.name, {}).setdefault(d.month, d.percentage_allocation) + target_details.setdefault(d.name, {}).setdefault(d.month, flt(d.percentage_allocation)) return target_details @@ -113,8 +113,8 @@ def get_territory_item_month_map(filters): })) tav_dict = tim_map[td.name][td.item_group][month] - month_percentage = td.distribution_id and \ - tdd.get(td.distribution_id, {}).get(month, 0) or 100.0/12 + month_percentage = tdd.get(td.distribution_id, {}).get(month, 0) \ + if td.distribution_id else 100.0/12 for ad in achieved_details.get(td.name, {}).get(td.item_group, []): if (filters["target_on"] == "Quantity"): diff --git a/stock/doctype/item/templates/includes/product_search_box.html b/stock/doctype/item/templates/includes/product_search_box.html index 55e6377781..96e571f21f 100644 --- a/stock/doctype/item/templates/includes/product_search_box.html +++ b/stock/doctype/item/templates/includes/product_search_box.html @@ -22,7 +22,7 @@ return false; }); $("#product-search").keypress(function(e) { - if(e.which==13) $("#btn-product-search").click(); + if(e.which==13) $("#btn-product-search").click(); }) })