* allow invoices to be made from sales returns * Update queries.py
This commit is contained in:
parent
bd0beb6c02
commit
f6d738b3c5
@ -227,21 +227,30 @@ 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, as_dict):
|
def get_delivery_notes_to_be_billed(doctype, txt, searchfield, start, page_len, filters, as_dict):
|
||||||
return frappe.db.sql("""
|
return frappe.db.sql("""
|
||||||
select `tabDelivery Note`.name, `tabDelivery Note`.customer, `tabDelivery Note`.posting_date
|
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 `tabDelivery Note`.is_return = 0
|
`tabDelivery Note`.docstatus = 1
|
||||||
and status not in ("Stopped", "Closed") %(fcond)s
|
and status not in ("Stopped", "Closed") %(fcond)s
|
||||||
and (`tabDelivery Note`.per_billed < 100 or `tabDelivery Note`.grand_total = 0)
|
and (
|
||||||
|
(`tabDelivery Note`.is_return = 0 and `tabDelivery Note`.per_billed < 100)
|
||||||
|
or `tabDelivery Note`.grand_total = 0
|
||||||
|
or (
|
||||||
|
`tabDelivery Note`.is_return = 1
|
||||||
|
and return_against in (select name from `tabDelivery Note` where per_billed < 100)
|
||||||
|
)
|
||||||
|
)
|
||||||
%(mcond)s order by `tabDelivery Note`.`%(key)s` asc
|
%(mcond)s order by `tabDelivery Note`.`%(key)s` asc
|
||||||
""" % {
|
""" % {
|
||||||
"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),
|
||||||
"txt": "%(txt)s"
|
"txt": "%(txt)s"
|
||||||
}, { "txt": ("%%%s%%" % txt) }, as_dict=as_dict)
|
}, {"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 = ""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user