From 9ae112bbfc8c821e8403fc5dcaa1e8b14ffae621 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Thu, 2 May 2019 19:32:43 +0530 Subject: [PATCH] fix: Inactive items report fix --- erpnext/patches.txt | 2 ++ .../report/inactive_items/inactive_items.py | 23 ++++++++----------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 9787dc8c64..bf67954393 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -599,3 +599,5 @@ erpnext.patches.v11_1.set_variant_based_on erpnext.patches.v11_1.woocommerce_set_creation_user erpnext.patches.v11_1.set_salary_details_submittable erpnext.patches.v11_1.rename_depends_on_lwp +erpnext.patches.v11_1.set_missing_title_for_quotation +execute:frappe.delete_doc("Report", "Inactive Items") diff --git a/erpnext/stock/report/inactive_items/inactive_items.py b/erpnext/stock/report/inactive_items/inactive_items.py index 8d879126da..f809913196 100644 --- a/erpnext/stock/report/inactive_items/inactive_items.py +++ b/erpnext/stock/report/inactive_items/inactive_items.py @@ -80,27 +80,24 @@ def get_data(filters): sales_invoice_data = get_sales_details(filters) for item in items: + row = { + "item_group": item.item_group, + "item": item.name, + "item_name": item.item_name + } + if sales_invoice_data.get(item.name): item_obj = sales_invoice_data[item.name] if item_obj.days_since_last_order > cint(filters['days']): - row = { + row.update({ "territory": item_obj.territory, - "item_group": item_obj.item_group, - "item": item_obj.name, - "item_name": item_obj.item_name, "customer": item_obj.customer, "last_order_date": item_obj.last_order_date, "qty": item_obj.qty, "days_since_last_order": item_obj.days_since_last_order - } - data.append(row) - else: - row = { - "item_group": item.item_group, - "item": item.name, - "item_name": item.item_name - } - data.append(row) + }) + + data.append(row) return data