From 28d85579059dbccf9292315cdfc50fc0730e54c3 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 22 Aug 2017 15:30:45 +0530 Subject: [PATCH] [fix] Taxes in itemised purchase register (#10494) --- .../item_wise_purchase_register.py | 2 +- .../item_wise_sales_register/item_wise_sales_register.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py index 8f9948e41c..0e5d12857e 100644 --- a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py +++ b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py @@ -18,7 +18,7 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum aii_account_map = get_aii_accounts() if item_list: itemised_tax, tax_columns = get_tax_accounts(item_list, columns, - tax_doctype="Purchase Taxes and Charges") + doctype="Purchase Invoice", tax_doctype="Purchase Taxes and Charges") columns.append({ "fieldname": "currency", 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 30c545f58c..dfcade25ed 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 @@ -139,7 +139,7 @@ def get_delivery_notes_against_sales_order(item_list): return so_dn_map -def get_tax_accounts(item_list, columns, tax_doctype="Sales Taxes and Charges"): +def get_tax_accounts(item_list, columns, doctype="Sales Invoice", tax_doctype="Sales Taxes and Charges"): import json item_row_map = {} tax_columns = [] @@ -155,11 +155,12 @@ def get_tax_accounts(item_list, columns, tax_doctype="Sales Taxes and Charges"): charge_type, base_tax_amount_after_discount_amount from `tab%s` where - parenttype = 'Sales Invoice' and docstatus = 1 + parenttype = %s and docstatus = 1 and (description is not null and description != '') and parent in (%s) order by description - """ % (tax_doctype, ', '.join(['%s']*len(invoice_item_row))), tuple(invoice_item_row.keys())) + """ % (tax_doctype, '%s', ', '.join(['%s']*len(invoice_item_row))), + tuple([doctype] + invoice_item_row.keys())) for parent, description, item_wise_tax_detail, charge_type, tax_amount in tax_details: if description not in tax_columns and tax_amount: