From cae13bf048042190dffe76f079827a523ab8e168 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 1 Feb 2018 18:58:14 +0530 Subject: [PATCH] Fixes in purchase register report (#12737) --- .../item_wise_sales_register/item_wise_sales_register.py | 4 ++-- .../accounts/report/purchase_register/purchase_register.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py index ab5251f292..8917c9ff63 100644 --- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py +++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py @@ -168,11 +168,11 @@ def get_tax_accounts(item_list, columns, company_currency, for d in item_list: invoice_item_row.setdefault(d.parent, []).append(d) - item_row_map.setdefault(d.parent, {}).setdefault(d.item_code, []).append(d) + item_row_map.setdefault(d.parent, {}).setdefault(d.item_code or d.item_name, []).append(d) conditions = "" if doctype == "Purchase Invoice": - conditions = " and category in ('Total', 'Valuation and Total')" + conditions = " and category in ('Total', 'Valuation and Total') and base_tax_amount_after_discount_amount != 0" tax_details = frappe.db.sql(""" select diff --git a/erpnext/accounts/report/purchase_register/purchase_register.py b/erpnext/accounts/report/purchase_register/purchase_register.py index 37848d5064..610475acfc 100644 --- a/erpnext/accounts/report/purchase_register/purchase_register.py +++ b/erpnext/accounts/report/purchase_register/purchase_register.py @@ -172,6 +172,7 @@ def get_invoice_tax_map(invoice_list, invoice_expense_map, expense_accounts): else sum(base_tax_amount_after_discount_amount) * -1 end as tax_amount from `tabPurchase Taxes and Charges` where parent in (%s) and category in ('Total', 'Valuation and Total') + and base_tax_amount_after_discount_amount != 0 group by parent, account_head, add_deduct_tax """ % ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)