Filters for multiselect dialog for DN/PR in Sales/Purchase Invoice (#8882)

This commit is contained in:
Nabin Hait 2017-05-17 13:52:21 +05:30 committed by GitHub
parent 3bd15fb19e
commit 1e2d7b3519
3 changed files with 15 additions and 11 deletions

View File

@ -79,7 +79,8 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
get_query_filters: { get_query_filters: {
docstatus: 1, docstatus: 1,
status: ["!=", "Closed"], status: ["!=", "Closed"],
company: me.frm.doc.company company: me.frm.doc.company,
is_return: 0
} }
}) })
}, __("Get items from")); }, __("Get items from"));

View File

@ -142,11 +142,12 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
target: me.frm, target: me.frm,
date_field: "posting_date", date_field: "posting_date",
setters: { setters: {
company: me.frm.doc.company customer: me.frm.doc.customer || undefined
}, },
get_query: function() { get_query: function() {
var filters = { var filters = {
docstatus: 1, docstatus: 1,
company: me.frm.doc.company
}; };
if(me.frm.doc.customer) filters["customer"] = me.frm.doc.customer; if(me.frm.doc.customer) filters["customer"] = me.frm.doc.customer;
return { return {

View File

@ -222,19 +222,21 @@ def get_project_name(doctype, txt, searchfield, start, page_len, filters):
"_txt": txt.replace('%', '') "_txt": txt.replace('%', '')
}) })
def get_delivery_notes_to_be_billed(doctype, txt, searchfield, start, page_len, filters): 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_name return frappe.db.sql("""
select `tabDelivery Note`.name, `tabDelivery Note`.customer, `tabDelivery Note`.posting_date
from `tabDelivery Note` from `tabDelivery Note`
where `tabDelivery Note`.`%(key)s` like %(txt)s and 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) and (`tabDelivery Note`.per_billed < 100 or `tabDelivery Note`.grand_total = 0)
%(mcond)s order by `tabDelivery Note`.`%(key)s` asc %(mcond)s order by `tabDelivery Note`.`%(key)s` asc
limit %(start)s, %(page_len)s""" % { """ % {
"key": searchfield, "key": searchfield,
"fcond": get_filters_cond(doctype, filters, []), "fcond": get_filters_cond(doctype, filters, []),
"mcond": get_match_cond(doctype), "mcond": get_match_cond(doctype),
"start": "%(start)s", "page_len": "%(page_len)s", "txt": "%(txt)s" "txt": "%(txt)s"
}, { "start": start, "page_len": page_len, "txt": ("%%%s%%" % txt) }) }, { "txt": ("%%%s%%" % txt) }, as_dict=as_dict)
def get_batch_no(doctype, txt, searchfield, start, page_len, filters): def get_batch_no(doctype, txt, searchfield, start, page_len, filters):
cond = "" cond = ""