From bd979ec1ed892d5b04c56ecdc022f3a47d6ab8ea Mon Sep 17 00:00:00 2001 From: RobertSchouten Date: Mon, 12 Sep 2016 09:46:10 +0800 Subject: [PATCH] [fix] itemwise sales register add sales invoice to delivery note when update stock in item wise sales register put sales invoice into delivery note field when delivery note is null and update stock ticked --- .../item_wise_sales_register/item_wise_sales_register.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 9f303499cb..39e38d7a13 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 @@ -30,6 +30,8 @@ def execute(filters=None): elif d.so_detail: delivery_note = ", ".join(frappe.db.sql_list("""select distinct parent from `tabDelivery Note Item` where docstatus=1 and so_detail=%s""", d.so_detail)) + if not delivery_note and d.update_stock: + delivery_note = d.parent row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date, d.customer, d.customer_name, d.customer_group, d.debit_to, d.mode_of_payment, d.territory, d.project, d.company, d.sales_order, @@ -84,7 +86,7 @@ def get_items(filters): si_item.item_code, si_item.item_name, si_item.item_group, si_item.sales_order, si_item.delivery_note, si_item.income_account, si_item.cost_center, si_item.qty, si_item.base_net_rate, si_item.base_net_amount, si.customer_name, - si.customer_group, si_item.so_detail, si.mode_of_payment + si.customer_group, si_item.so_detail, si.update_stock, si.mode_of_payment from `tabSales Invoice` si, `tabSales Invoice Item` si_item where si.name = si_item.parent and si.docstatus = 1 %s order by si.posting_date desc, si_item.item_code desc""" % conditions, filters, as_dict=1)