From 1e2d7b35197536e49cda97148d7600377870e89a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 17 May 2017 13:52:21 +0530 Subject: [PATCH 1/2] Filters for multiselect dialog for DN/PR in Sales/Purchase Invoice (#8882) --- .../purchase_invoice/purchase_invoice.js | 3 ++- .../doctype/sales_invoice/sales_invoice.js | 3 ++- erpnext/controllers/queries.py | 20 ++++++++++--------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index 63de8789c1..b48fb20d6f 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -79,7 +79,8 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ get_query_filters: { docstatus: 1, status: ["!=", "Closed"], - company: me.frm.doc.company + company: me.frm.doc.company, + is_return: 0 } }) }, __("Get items from")); diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index f2357226cd..007afe4b63 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -142,11 +142,12 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte target: me.frm, date_field: "posting_date", setters: { - company: me.frm.doc.company + customer: me.frm.doc.customer || undefined }, get_query: function() { var filters = { docstatus: 1, + company: me.frm.doc.company }; if(me.frm.doc.customer) filters["customer"] = me.frm.doc.customer; return { diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py index 2f98e865bc..0fc08c1cc3 100644 --- a/erpnext/controllers/queries.py +++ b/erpnext/controllers/queries.py @@ -222,19 +222,21 @@ def get_project_name(doctype, txt, searchfield, start, page_len, filters): "_txt": txt.replace('%', '') }) -def get_delivery_notes_to_be_billed(doctype, txt, searchfield, start, page_len, filters): - return frappe.db.sql("""select `tabDelivery Note`.name, `tabDelivery Note`.customer_name +def get_delivery_notes_to_be_billed(doctype, txt, searchfield, start, page_len, filters, as_dict): + return frappe.db.sql(""" + select `tabDelivery Note`.name, `tabDelivery Note`.customer, `tabDelivery Note`.posting_date from `tabDelivery Note` where `tabDelivery Note`.`%(key)s` like %(txt)s and - `tabDelivery Note`.docstatus = 1 and status not in ("Stopped", "Closed") %(fcond)s + `tabDelivery Note`.docstatus = 1 and `tabDelivery Note`.is_return = 0 + and status not in ("Stopped", "Closed") %(fcond)s and (`tabDelivery Note`.per_billed < 100 or `tabDelivery Note`.grand_total = 0) %(mcond)s order by `tabDelivery Note`.`%(key)s` asc - limit %(start)s, %(page_len)s""" % { - "key": searchfield, - "fcond": get_filters_cond(doctype, filters, []), - "mcond": get_match_cond(doctype), - "start": "%(start)s", "page_len": "%(page_len)s", "txt": "%(txt)s" - }, { "start": start, "page_len": page_len, "txt": ("%%%s%%" % txt) }) + """ % { + "key": searchfield, + "fcond": get_filters_cond(doctype, filters, []), + "mcond": get_match_cond(doctype), + "txt": "%(txt)s" + }, { "txt": ("%%%s%%" % txt) }, as_dict=as_dict) def get_batch_no(doctype, txt, searchfield, start, page_len, filters): cond = "" From def2e4678c9aa2104355628ebccd68adb1c5369d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 17 May 2017 14:24:04 +0600 Subject: [PATCH 2/2] bumped to version 8.0.28 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 7046172c9a..8b6609ce57 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import frappe -__version__ = '8.0.27' +__version__ = '8.0.28' def get_default_company(user=None): '''Get default company for user'''